且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误2003(HY000):无法连接到"127.0.0.1"上的MySQL服务器(111)

更新时间:2022-12-02 15:16:57

如果使用的是ubuntu,则必须使用以下步骤来避免此错误(如果未启用复制):

If you are using ubuntu, you have to use the following steps to avoid this error(if there is no replication enabled):

  1. 运行命令vim /etc/mysql/my.cnf
  2. 使用#符号注释bind-address = 127.0.0.1
  3. 重新启动您的mysql服务器一次.
  1. run the command vim /etc/mysql/my.cnf
  2. comment bind-address = 127.0.0.1 using the # symbol
  3. restart your mysql server once.

更新

在步骤1中,如果在my.cnf文件中找不到bind-address,请在/etc/mysql/mysql.conf.d/mysqld.cnf文件中查找.

In Step 1, if you cannot find bind-address in the my.cnf file, look for it in /etc/mysql/mysql.conf.d/mysqld.cnf file.

在启用MySQL复制的情况下进行更新

尝试在IP上连接MySQL服务器,该服务器已在'my.cnf instead of localhost或127.0.0.1`中绑定了MySQL服务器.

Try to connect MySQL server on IP for which MySQL server is bind in 'my.cnfinstead oflocalhost or 127.0.0.1`.