MySQL“无法连接到主机[主机],因为访问被拒绝。”

时间:2013-06-20 22:16:16

标签: mysql wildcard remote-access access-denied

我在远程连接MySQL服务器时出现问题。我知道我的用户使用来自任何主机的'%'通配符进行设置,因此我应该可以访问服务器。我可以使用我的凭据在MySQL服务器上本地登录,而不是远程登录。

我在my.cnf中的设置如下:

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

[mysqld]
user            = mysql
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#
bind-address            = 128.xxx.xxx.xxx

我正在使用以下参数连接(使用Coda2 GUI - 但问题似乎与Coda2无关):

Server: 128.xxx.xxx.xxx
Port: 3306
Username: sadmicrowave
Password: my_mysql_password

发布的完整错误消息是:

 Unable to connect to host uslonsweb003 because access was denied.
 Double-check your username and password and ensure that access from your current location is permitted.

 MySQL said: Access denied for user 'sadmicrowave'@'128.xxx.xxx.xxx' (using password: YES)

我可以使用IP地址和3306 telnet到我的服务器,所以我知道服务器正在监听该端口......

到底发生了什么事?

1 个答案:

答案 0 :(得分:0)

您是否在授予对通配符用户的访问权限后发布了the flush privileges

如果使用user = sadmicrowave和host = [您的实际IP]添加条目会发生什么(添加用户后不要忘记发出flush privileges命令)?