关于mysql:mysql开启远程连接

出发点

因为桥梁我的项目须要用到MySQL数据库,想着本人实验室服务器的MySQL曾经装好了,就装置Navicat筹备近程连贯,通过shell进行连贯发现运行失常

mysql -u root -p

然而应用Navicat连贯时呈现谬误,回绝连贯,于是想到可能MySQL不容许近程登录

开启近程IP登录许可

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 127.0.0.1后面加上#

lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address          = 127.0.0.1

之后重启MySQL即可

/etc/init.d/mysql restart

增加用户

开启近程登录之后发现呈现了新的谬误:... is not allowed to connect to this MySql server
于是通过shell登录MySQL,顺次执行以下命令

use mysql;
update user set host=’%’ where user=’root’;

遂近程连贯胜利

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理