Mysql從client連接server連不上的問題
報的錯誤為
ERROR 1130: Host ’192.168.5.3’ is not allowed to connect to this MySQL server
www.2cto.com
查過資料后發現這個問題,一般都會遇到。My
sql數據庫跟其它數據庫不一樣,須要設置權限能夠控制哪台機器能訪問數據庫。能訪問哪些表。
所以就要登上server。
C:\Documents and Settings\Administrator>
mysql -h localhost -u root -p
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.43-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
www.2cto.com
mysql> grant all privileges on *.* to root@'%' identified by '123' with grant
-> option;
Query OK, 0 rows affected (0.00 sec)
意思就是將server上的全部資源都給root用戶權限,%代表來自不同的IP
這里須要注意一下要把password也要帶上。通過password123登錄。
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
最后要刷新下權限。
這樣就從本地192.168.5.3這個IP的client連接到server上了