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
Need to modify the database configuration file
#确认你的数据库配置文件路径对不对
vi /etc/mysql/my.cnf
After entering, [mysql]
add below and bind-address = 0.0.0.0
press esc
, enter to :wq
save and exit.
#重启mysql即可
systemctl restart mysql.service