不允許遠端連線這個資料庫,你看下mysql埠是否開啟,另外檢視一下mysql是否允許遠端連線
幾個解決方案,自己看下
1.修改改mysql配置檔案(/etc/mysql/my.cnf),註釋以下行:
#bind-address=127.0.0.1
2.重啟mysql資料庫,對於ubuntu系統,執行如下命令
sudo/etc/init.d/mysqlrestart
3.以root使用者登入mysql後,執行如下命令:
grantallprivilegeson*.*toroot@’允許登入的遠端機器ip’
identifiedby‘密碼’
或者
grantallprivilegeson*.*to"myuser"@"%"identifiedby"mypassword"withgrantoption;
如果你想允許使用者myuser從ip為168.160.12.50的主機連線到mysql伺服器,並使用mypassword作為密碼
grantallprivilegeson*.*to"myuser"@"168.160.12.50"identifiedby"mypassword"withgrantoption;
不允許遠端連線這個資料庫,你看下mysql埠是否開啟,另外檢視一下mysql是否允許遠端連線
幾個解決方案,自己看下
1.修改改mysql配置檔案(/etc/mysql/my.cnf),註釋以下行:
#bind-address=127.0.0.1
2.重啟mysql資料庫,對於ubuntu系統,執行如下命令
sudo/etc/init.d/mysqlrestart
3.以root使用者登入mysql後,執行如下命令:
grantallprivilegeson*.*toroot@’允許登入的遠端機器ip’
identifiedby‘密碼’
或者
grantallprivilegeson*.*to"myuser"@"%"identifiedby"mypassword"withgrantoption;
如果你想允許使用者myuser從ip為168.160.12.50的主機連線到mysql伺服器,並使用mypassword作為密碼
grantallprivilegeson*.*to"myuser"@"168.160.12.50"identifiedby"mypassword"withgrantoption;