出发点
因为桥梁我的项目须要用到 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’;
遂近程连贯胜利