mysql1846错误_远程连接MySQL报错ERROR 2003解决办法
轉自https://blog.csdn.net/hjwang1/article/details/51669223
問題代碼代碼
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.19' (111)
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.19' (111) 這個 原因就是Mysql數據庫的默認配置文件my.cnf(linux下)中的bind-address默認為127.0.0.1,所以就算你創建了可以 remote訪問的用戶,你也不能使用mysql -h命令進行訪問,若訪問就會出現上出問題,因為此時Mysql只接受localhost,所以需要把bind-address屏蔽掉。
my.cnf一般在/etc/mysql下面,如果不在使用locate my.cnf查找,修改前的my.cnf配置文件為:
修改前的my.cnf配置文件代碼
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
我們需要做的就是屏蔽這個bind-address代碼,屏蔽后代碼為:
屏蔽后my.cnf配置文件代碼
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
現在你就可以用mysql -h命令進行你想做的操作了,如登錄系統:
登陸數據庫代碼
mysql -h 192.168.0.19 -u root -p
總結
以上是生活随笔為你收集整理的mysql1846错误_远程连接MySQL报错ERROR 2003解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python算法详解豆瓣_豆瓣爬虫实践-
- 下一篇: php判断有没有登录,请问thinkph