在連接本機的mysql 數據庫時,配置連接信息,連接發生錯誤,提示:message from server: "Host '192.168.1.10' is not allowed to connect to this MySQL server
但是將IP地址改爲localhost又能正常連接到MySQL數據庫。
臨時處理方案:
1、先用localhost方式連接到MySQL數據庫,然後使用MySQL自帶的數據庫mysql;
use mysql;
2、執行:select host from user where user = 'root'; 發現,host的值就是localhost。
所以將它的值改掉:update user set host='%' where user = 'root';
3、修改完成後,執行:flush privileges;
將修改內容生效,再次配置時,用IP地址或者localhost 就都能正常連接到MySQL數據庫了。