Cant connect to MySQL server on localhost (10061), database connection error, unable to connect remotely

Navicat connection data always reports this error, but the server firewall port permissions and mysql remote connection have been opened, and the database can be accessed locally.

At this time netstat -tunlp, check the network port and find that the localAddress of the database is 127.0.0.1
Insert image description here

Need to modify the database configuration file

#确认你的数据库配置文件路径对不对
vi /etc/mysql/my.cnf

After entering, [mysql]add below and bind-address = 0.0.0.0
Insert image description here
press esc, enter to :wqsave and exit.

#重启mysql即可
systemctl restart mysql.service

Guess you like

Origin blog.csdn.net/u014292402/article/details/126958888