메뉴 건너뛰기

Korea Oracle User Group

DBMS

MySQL MySQL 설치 후 외부 접속 허용하기

명품관 2016.09.09 16:57 조회 수 : 1101

MySQL 설치 후 외부 접속 허용하기

 

MySQL을 설치하면 기본적으로 로컬에서만 접속이 가능하고 외부에서는 접속이 불가능하다.

외부에서 접속하면 아래와 같은 에러메시지를 받게 된다.

 

Host '111.111.111.111' is not allowed to connect to this MySQL server

 

아래와 같이 외부 접속에 대한 권한을 부여해야 한다.

 

[root@testora ~]# 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.7.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '패스워드' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> GRANT TRIGGER ON *.* TO 'root'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SUPER ON *.* TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> 

 

위로