Mysql遠端連線Error1130解決方法
阿新 • • 發佈:2019-01-30
對於1130這個錯誤,大家網上查到都知道是“無法給遠端連線的使用者許可權”的原因,網上的方法都一樣,都是修改user表中host屬性,但是可能修改後還是連不上,對於這個問題,可以試試如下方法:
執行命令重新配置一下MySQL(下面那些都是字面的意思,就不做解釋了):
sudo mysql_secure_installation
Enter password for user root: '填密碼'
Press y|Y for Yes, any other key for No: n
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
然後 use mysql
切換到mysql資料庫,查詢user表。
select host from user where user = 'root';
host |
---|
host |
修改為’%’
update user set host='%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
重新整理許可權,注意這裡結果是沒變化的,這裡是沒問題的,不要懷疑
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
重啟MySQL服務,遠端連線可用。