[MYSQL] 원격 접속 문제

2013. 1. 10. 17:27DB/MYSQL

몰라 어떻게 하다가 보니 됐다....;;

뭘까...

해본거 일단 모두 적어놔야지...

일단 user계정에서 추가하는 것

user Mysql; 

insert into user(host,user,password) values('192.168.0.103','root',password('1111'));

뭐든지 끝나면 무조건 

flush privileges;

또 다른건

use mysql;

grant all privileges on *.* to 'root'@'localhost' identified by '1111';

여기서 localhost는 자기자신만 사용할때 사용하고 localhost말고

특정 IP를 가르키고 싶으면 localhost대신 입력하면 특정 IP로 되고 만약에 모든 IP는

%를 해주면 된다.




1) 

user Mysql; 

insert into user(host,user,password) values('192.168.0.103','root',password('1111'));

flush privileges;


2)

use mysql;

grant all privileges on *.* to 'root'@'localhost' identified by '1111';

flush privileges;


3)

use mysql;

grant all privileges on *.* to 'root'@'%' identified by '1111';

flush privileges;


4)

insert into user (host, user, password) values ('my_address', 'my_name', password('my_pw'));

insert into db values('my_address', 'db_name', 'my_name', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y' ,'y');

flush privileges;