今天在ubuntu上安裝了mysql服務器,在windows上用客戶端軟件連接mysql服務器時,出現錯誤:
錯誤碼:2003 不能連接到 MySQL 服務器在 (10061)
折騰來折騰去沒搞好,防火牆也關了,3306端口也添加到了出站規則,但就是連不上,后來無意間看到一篇帖子,得到了提示。打開/etc/mysql/my.cnf
看到以下內容:
# # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1 #
也就是說mysql服務器默認綁定了127.0.0.1端口,這樣其他遠程客戶端當然無權訪問啦,我們這里把bind-address = 127.0.0.1
注釋掉,結果如下所示:
# # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. # bind-address = 127.0.0.1 #
然后重啟mysql服務:
sudo restart mysql
成功解決!