统环境:Ubuntu 16.04.4
mysql 版本:5.7.24-0ubuntu0.16.04.1 (Ubuntu)
连接报错:2003 - Can't connect to MySQL server on 'XXX' (61 "Connection refused")
可用该命令检查mysql启动端口:netstat -tulpen
用户root User表中已将将host改成‘%’ 仍然无法被外部连接
找到下图文件/etc/mysql/mysql.conf.d/mysqld.cnf
将bind-address = 127.0.0.1注释
(如何找到bind-address = 127.0.0.1文件,先找到/etc/mysql/my.cnf)
sudo service mysql restart
分配权限
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'mypwd' WITH
GRANT OPTION;
2.FLUSH PRIVILEGES;
网友评论