*페도라코어4 서버
먼저 mysql.com에서 서버 rpm과 client rpm을 받는다 각각 여기서 받았다
http://dev.mysql.com/downloads/mysql/5.0.html#linux-static-x86-32bit-rpms
그리고나서
rpm -Uvh 으로 설치를 해준다
[root@localhost mysql]# ls -l
합계 25044
-rw-r--r-- 1 root root 6527645 7월 25 17:15 MySQL-client-5.0.45-0.i386.rpm
-rw-r--r-- 1 root root 19077102 7월 25 17:15 MySQL-server-5.0.45-0.i386.rpm
[root@localhost mysql]# rpm -Uvh MySQL-server-5.0.45-0.i386.rpm
[root@localhost mysql]# rpm -Uvh MySQL-client-5.0.45-0.i386.rpm
system-config-services 명령으로 mysql 서비스를 항상 가동되도록 체크되어잇는지 확인하고
"service mysql start"명령으로 mysql 데몬을 시작한다
외부에서 사용할수있도록 system-config-securitylevel 명령으로 mysql포트를 열어준다
mysql포트는 3306이므로 그외의 포트부분에서 "3306: tcp:"라고 써준다
처음에 mysql만 입력하면 접속이 되는데 바꿔줘야한다
mysqladmin -u root password '1234'
계정은 root이고 암호는 1234이다
그리고 mysql -u root -p 로 입력한후
패스워드 입력후 접속한다
윈도우즈 클라이언트 설치
http://dev.mysql.com/downloads/mysql/5.0.html#win32
여기가서
Windows Essentials (x86)
이놈을 다운받는다
그리고 인스톨시 서버설치는 하지않고(custom설치)
client프로그램에서 MySQL sever Instance Config역시 설치를 하지않고
대충 c:\mysql폴더에다 설치한다
윈도우에서 원격접속시
mysql -h <호스트또는 IP> -u <사용자이름>-p로 하면 되지만 원칙적으로 mysql서버에서는 외부에서 접근할
도메인을 등록해줘야한다
페도라 서버에가서 mysql에 접속뒤
use mysql;
root@localhost mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.0.45-community MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user,host from user
-> ;
+------+-----------------------+
| user | host |
+------+-----------------------+
| root | 127.0.0.1 |
| root | 192.168.248.1 |
| root | 222.96.17.205 |
| root | localhost |
| root | localhost.localdomain |
+------+-----------------------+
5 rows in set (0.00 sec)
위에 결과를 분석하자면 root에대해 로컬호스트외
192.168.248.1과 222.96.17.205 주소에대해 허용해주고 있다
추가해주는 쿼리문은
grant all privileges on *.* to 'root'@i'paddres'
identified by '비밀번호';
하면 등록이 될것이다
그럼 윈도우 커맨드 창에서 접속을 시도해보자
[root@localhost mysql]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:CC:74:72
inet addr:192.168.248.204 Bcast:192.168.248.255 Mask:255.255.255.0
페도라 서버의 ipaddress
C:\mysql\bin>mysql -h 192.168.248.204 -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.0.45-community MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
원격 접속이 되는걸 확인할수있다
가령 mysql서버의 아이디와 패스워드 노출시 또는 강제적인 원격 접속이 가능하도록 변경된다면 위와같은
절차를 이용할것이다~
*grant는 사용자를 생성해주는 sql 구문이다 형식은 아래와 같다.
grant <사용권한> on <데이터베이스이름>.<테이블이름> to '<사용자이름>'@'<호스트이름>' IDENTIFIED BY '비밀번호';
사용_권한을 ALL PRIVILIEGES로 쓰면 모든 권한을 다 준다는 의미다. 권한의 일부만 주기위해서는 SELECT,INSERT,UPDATE,DELETE등을 별도로 줄수있다
<데이터베이스 이름>.<테이블 이름>을 *.*로 쓰면 모든 데이터베이스와 모든 테이블에 접근이 가능하다는 의미다.만약,mysql DB의 user 테이블만 사용할수 있도록 허락하려면 mysql.user라고 써 주면 된다.
이 글과 관련있는 글을 자동검색한 결과입니다 [?]
- 리눅스에서 MYSQL 설정 by 변익수
- 커널! by honam
- [mysql]초기 mysql root 패스워드 설정 및 비번 변경과 root 비번 잃어버렸을 경우 by spongebody
- mysql 4.1 업뎃 후 mysql_connect() 접속 에러 by 변익수
- APM_Setup에서 MySQL 변경 by Asllan