mysql ERROR 2003 (HY000):Can't connect to MySQL server on

文章目录

场景

  • 环境
    • ubuntu16.04
  • 负载均衡的2台机器使用同一台服务器上的数据库,在创建一个可以远程连接的用户,并且付给这个数据库的读写权限后, 连接数据库遇到了这个问题

分析

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

#Instead of skip-networking the default is now to listen only on
#ocalhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

mysql 默认只监听127.0.0.1

解决

  • bind-address = 127.0.0.1 换成内网IP

猜你喜欢

转载自blog.csdn.net/cominglately/article/details/85637365
今日推荐