mysql远程无法登陆出现ERROR 2003 (HY000)...解决方法

本文详细解释了在另一台机器上登录MySQL时遇到的ERROR2003(HY000)和ERROR1045(28000)错误,并提供了相应的解决方法。对于ERROR2003(HY000),文章指出这是由于MySQL默认配置只允许本地登录,通过修改my.cnf文件中的bind-address配置可以解决此问题。对于ERROR1045(28000),原因在于登录用户名未设置远程主机登录权限,通过修改MySQL数据库中user表中的Host字段即可解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

mysql远程无法登陆出现ERROR 2003 (HY000)...解决方法
2011年08月14日
  Q: 当在另一台机器上登录MySQL时出现如下错误:
  ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x' (111)
  A: 原因是MySQL考虑到安全因素,默认配置只让从本地登录
  打开 /etc/mysql/my.cnf 文件,找到 bind-address = 127.0.0.1 修改为 bind-address = 0.0.0.0 重启mysql : sudo /etc/init.d/mysql restart 可参考: > I've already check my /etc/my.cnf file for a "binding"
  > line. Its not
  > there. I also found an item online that indicated
  > adding:
  > Look for the option "skip-networking". This disables TCP/IP so the
  server only accepts local connections via the Unix socket. This sounds
  like your situation.
  Note that a "could not connect" error means just that. If the problem
  was related to user privileges you would get an "access denied" error.
  Q: 还一种情况出现类似下面的错误:
  ERROR 1045 (28000): Access denied for user 'test'@'x.x.x.x' (using password: NO)
  A: 原因是没有给登录用户名设置远程主机登录的权限。
  在本地用 root 登录: mysql -u root -p
  修改 MySQL 数据库中 user 表中 对应用户名的 Host 字段,将 localhost 改为 %
  use mysql;
  update user set Host = '%' where User = 'username';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值