MySQL錯誤:Can't connect to MySQL server (10060)

來源:互聯網
上載者:User

當遠端連線MySQL資料庫的時候顯示Can't connect to MySQL server (10060),我們從以下幾個方面入手,找出錯誤的原因:

1.網路不通。

檢查能不能ping通。

2.防火牆設定。

防火牆是否放過mysql的進程,是否屏蔽了mysql的3306連接埠。

3.mysql的賬戶設定。

mysql賬戶是否不允許遠端連線。如果無法串連可以嘗試以下方法:

mysql -u root -p    //登入MySQL

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;     //任何遠程主機都可以訪問資料庫

mysql> FLUSH PRIVILEGES;    //需要輸入次命令使修改生效

mysql> EXIT    //退出

也可以通過修改表來實現遠程:

mysql -u root -p

mysql> use mysql;

mysql> update user set host = '%' where user = 'root';

mysql> select host, user from user;

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.