본문 바로가기

프로그램 경험/Database

[MySql] mysql 계정 추가 및 외부 접속

mysql> use mysql;

Database changed


mysql> grant all privileges on dbname_or_astrisk.* to testid@localhost identified by '1234' with grant option;


//dbname_or_astrisk : DB 이름을 지정 하면 해당 DB만 접근가능, *은 모든 DB 접근 가능

//testid@localhost : testid에 추가할 계정명을, localhost에는 '%'를 넣으면 외부 접근 가능


mysql> flush privileges;

Query OK, 0 rows affected (0.09 sec)


이렇게 했는데 외부접근 안된다면 my.ini 파일의 설정중 아래 내용이 존재할 것이다. 주석 처리 하라.


bind-address=127.0.0.1