新安裝mysql 第三方工具連接不上問題


Mysql從client連接server連不上的問題
 
公司要用Mysql做一個測試,開始在自己的本地建一個Mysql 數據庫自己本地的程序再連上去,沒有遇到過連接不上的問題。
這次數據庫在server上。從本地client連接就是被拒絕。 
 
報的錯誤為 
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上了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM