星期五, 6月 01, 2012

[Mysql] Host ‘yourhost’ is not allowed to connect to this MySQL server錯誤

連線MySQL時,出現標題上的錯誤訊息,
這個問題是此IP位址未授權給MYSQL
解決方法:直接在下SQL語法設定即可

補充:
進入設定檔 改bind-address

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0

1.登入mysql
shell>mysql -u root -p
mysql>use mysql

2.設定資料庫的使用權限

允許所有連線

mysql>GRANT ALL PRIVILEGES ON *.* TO ‘MySQL帳號’@'%’ IDENTIFIED BY ‘MySQL密碼’ WITH GRANT OPTION;
Tip:% 代表不限client的連線ip

設定特地連結的ip

mysql>GRANT ALL PRIVILEGES ON *.* TO ‘MySQL帳號’@'你要連線IP‘ IDENTIFIED BY ‘MySQL密碼’ WITH GRANT OPTION;

3.最後一定要更新權限
mysql>FLUSH PRIVILEGES;

Reference:
[MySQL]解決ERROR 1130: Host ‘yourhost’ is not allowed to connect to this MySQL server錯誤無法遠端連接MySQL:message from server: "Host xxx is not allowed to connect to this MySQL server"
MySQL的重要語法

沒有留言:

張貼留言

留個話吧:)