MYSQL不能從遠程連接的解決方法
MYSQL不能從遠程連接的解決方法
◆爲了在其它電腦上能用root用戶登錄,需進行以下動作:
首先確定防火牆允許客戶端訪問mysql服務器
1、 mark>mysql -h localhost -u root
//這樣應該可以進入MySQL服務器
2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'; (注意要帶單引號)
grant all privileges on *.* to root@"192.168.1.125" identified by "kq49dvz";
//賦予任何主機訪問數據的權限
3、mysql>FLUSH PRIVILEGES
//修改生效
4、mysql>EXIT
//退出MySQL服務器
這樣就可以在其它任何的主機上以root身份登錄啦!
客戶端(windows)
c:\program files\mysql\mysql server 5.1\bin>mysql -h 192.168.0.249 -uroot -p
enter password:
遠程報錯:
ERROR 2003(HY000):Can't connect to MySQL server on '192.168.0.249' (10065)
把linux服務器的防火牆添加端口tcp: 3306後就OK了。
c:\program files\mysql\mysql server 5.1\bin>mysql -h 192.168.0.249 -uroot -p
enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version:4.1.22-standard-log
Type 'help' or '\h' for help. Type '\c' to clear the buffer.
mysql>
如果出現: 1045 Access denied for user 'root'@'192.168.1.3' (using password:YES) 錯誤的話。
是因爲上述第二步密碼爲'%' 所以不用加密碼即可。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.