pascal连接mysql_主机’xxx.xx.xxx.xxx’不允许连接到此MySQL服务器

可能是安全预防措施。您可以尝试添加新的管理员帐户:

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'

-> WITH GRANT OPTION;

mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'

-> WITH GRANT OPTION;

虽然Pascal和其他人已经注意到有一个用户拥有这种访问权限开放给任何IP不是一个好主意。如果您需要管理用户,请使用root,并将其留在localhost。对于任何其他操作,完全指定您需要的权限,并限制用户的可访问性,如下面的Pascal建议。

编辑:

从MySQL常见问题:

If you cannot figure out why you get Access denied, remove from the user table all entries that have Host values containing wildcards (entries that contain ‘%’ or ‘_’ characters). A very common error is to insert a new entry with Host=’%’ and User=’some_user’, thinking that this allows you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host=’localhost’ and User=”. Because that entry has a Host value ‘localhost’ that is more specific than ‘%’, it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host=’localhost’ and User=’some_user’, or to delete the entry with Host=’localhost’ and User=”. After deleting the entry, remember to issue a FLUSH PRIVILEGES statement to reload the grant tables. See also Section 5.4.4, “Access Control, Stage 1: Connection Verification”.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值