ERROR 2003 (HY000): Can’t connect to MySQL server on ’192.168.119.105′ (10061)

来自http://tunps.com/error-2003-hy000-cant-connect-to-mysql-server-on-192-168-119-105-10061

报错原因
  • 默认mysql是无法远程连接,需要修改mysql.user的Host字段,默认Host字段的的数据都是’127.0.0.1′ 只能本地连接数据库,可以修改为’%',然后flush privileges;这样就可以远程访问了。如果这因为这个原因而无法远程访问的错误提示是:ERROR 1045 (28000): Access denied for user ‘yushan’@’192.168.119.102′ (using password: YES)。
  • 我在linux上安装了mysql,远程使用windows连接,结果提示:ERROR 2003 (HY000): Can’t connect to MySQL server on ’192.168.119.105′ (10061),找到这一句: bind-address           = 127.0.0.1 ,将其注释掉,然后sudo service mysql restart 重启动。可以连接了!
  • 如果是windows平台的mysql服务器无法被远程连接,可以禁用windows防火墙(net stop sharedaccess),mysql平台:/etc/init.d/iptables stop
  • 确认/etc/mysql/my.cnf文件skip-networking 选项也被注释掉。skip-networking的作用是禁用tcp/ip连接,彻底杜绝mysql远程连接。现在新版本都没有开启skip-networking。

About tunpishuang

just 4 fun·····
This entry was posted in 未分类 and tagged . Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>