반응형

Mysql에 원격 접속을 하기 위해서는 /etc/my.cnf 파일에 다음 두 파라미터 파일이  comment out 되어 있어야 하며, 데이터 베이스에 대한 접속 권한을 부여 하여야 한다.


[root@mysql ~]# service mysqld stop

Stopping mysqld:                                           [  OK  ]

[root@mysql ~]# vi /etc/my.cnf   (다음의 파라미터 comment out)

#bind-address=127.0.0.1

#skip-networking

[root@mysql ~]# service mysqld start

Starting mysqld:                                           [  OK  ]

 

[root@mysql ~]# mysql -u root -p mysql

Enter password:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.13-log 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> grant all privileges on *.* to 'root'@'%' identified by 'root1122' with grant option;  

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges ;

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye

 

원격 접속 테스트

[root@mysql ~]# mysql -h192.168.10.15 -uroot -p mysql

Enter password:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 23

Server version: 5.7.13-log 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> show databases ;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

| tpch               |

+--------------------+

5 rows in set (0.00 sec)

반응형

+ Recent posts