If you are using ubuntu
, you have to use the following steps to avoid this error(if there is no replication enabled):
- run the command
vim /etc/mysql/my.cnf
- comment
bind-address = 127.0.0.1
using the # symbol
- restart your mysql server once.
Update
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.
Update in case of MySQL replication enabled
Try to connect MySQL server on IP
for which MySQL server is bind in 'my.cnfinstead of
localhost or 127.0.0.1`.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…