navicat 工具連接報如上錯誤。
解決方法:
1、授權
mysql>grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;
mysql>flush privileges;
2、打開/etc/my.cnf
將選項skip-networking注釋掉(注:有的資料上說還要講bind-address設置成127.0.0.1,我的配置文件中反正沒看到這句話,也就沒有設置。這個選項是用來設置可以進行外部訪問Mysql的IP,有一個過濾的作用,也沒有必要設置)。
3、去看看防火牆有沒有屏蔽掉3306端口。Centos系統的話,在 /etc/sysconfig/iptables 中,有沒有這樣一句話:
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT沒有就加上,或者后面的ACCEPT是DROP,將改成ACCEPT就行了
4、重啟防火牆和mysql
service iptables restart
service mysql restart