MySQL新用户访问被拒绝 [英] mysql new user access denied

查看:567
本文介绍了MySQL新用户访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是从mysql开始.我以root用户身份登录,并按照在线参考来创建新用户:

Just started with mysql. I login with root and follow the online reference to create a new user:

mysql> CREATE USER 'abc'@'%' IDENTIFIED BY '111111';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'abc'@'%' WITH GRANT OPTION;

然后我退出并尝试使用新用户登录:

then I quit and tried to login with the new user:

mysql --user=abc --password=111111 mysql

但收到错误消息:

拒绝用户'abc'@'localhost'的访问(使用密码:是)

Access denied for user 'abc'@'localhost' (using password: YES)

我错过了什么吗?

推荐答案

运行此程序即可

FLUSH PRIVILEGES

为用户提供所需的特权后,需要FLUSH特权才能完成设置并使新设置生效.为此,请在SQL命令提示符下运行以下命令:

Once you have given the desired privileges for your user, you will need to FLUSH privileges in order to complete the setup and to make the new settings work. To do so, run this command within the SQL command prompt:


如果您还想从localhost连接,则应该创建另一个帐户.


If you want to connect from localhost also, you should create another account.

必须同时拥有两个帐户才能使用户"建立联系 从任何地方作为用户".如果没有localhost帐户,则 由创建的本地主机的匿名用户帐户 当用户"从 本地主机.结果,用户"将被视为匿名用户. 原因是匿名用户帐户具有更多 特定的主机列值,而不是'user'@'%'帐户,因此 用户表排序顺序中的更早位置. )

It is necessary to have both accounts for 'user' to be able to connect from anywhere as 'user'. Without the localhost account, the anonymous-user account for localhost that is created by mysql_install_db would take precedence when 'user' connects from the local host. As a result, 'user'would be treated as an anonymous user. The reason for this is that the anonymous-user account has a more specific Host column value than the 'user'@'%' account and thus comes earlier in the user table sort order. )

仅供参考: http://dev.mysql.com/doc/refman/5.5/en/adding-users.html

这篇关于MySQL新用户访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆