当前位置:Gxlcms > 数据库问题 > Ubuntu16 远程连接MySQL

Ubuntu16 远程连接MySQL

时间:2021-07-01 10:21:17 帮助过:23人阅读

1、进入MySQL配置目录允许其他IP可以链接

vi /etc/mysql/mysql.conf.d/mysqld.cnf

吧下面这行注释掉

#bind-address           = 127.0.0.1

2、远程连接还是失败,查看日志发现会把访问IP去查找域名,关闭DNS解析

 

#vi /etc/mysql/my.cnf

加上这个

skip-name-resolve

3、链接仍然失败,查看日志发现关闭DNS解析后找不到自己域名

1       100616 21:05:15 [Warning] ‘user‘ entry ‘root@hexuweb101‘ ignored in --skip-name-resolve mode.
2	100616 21:05:15 [Warning] ‘user‘ entry ‘@hexuweb101‘ ignored in --skip-name-resolve mode.

  把数据库里面Mysql库里面的user表的主机改成IP

 

 update user set Host=‘11。x.x.x where User=‘mysql.sys‘;

update user set Host=‘11.x.x.x‘ where User=‘root‘;

flush privileges;

  然后重启下数据库服务器,链接成功

 

Ubuntu16 远程连接MySQL

标签:进入   找不到   dns   远程   set   服务   use   mysql配置   my.cnf   

人气教程排行