首先让我提一下,我已经看了很多建议的问题,但没有找到相关的答案。这就是我正在做的。
我连接到Amazon EC2实例。我可以用这个命令登录MySQL根目录:
mysql -u root -p
然后我用host %创建了一个新的用户帐单
CREATE USER 'bill'@'%' IDENTIFIED BY 'passpass';
授予用户bill的所有权限:
grant all privileges on *.* to 'bill'@'%' with grant option;
然后我退出root用户,尝试用bill登录:
mysql -u bill -p
输入正确的密码并得到以下错误:
错误1045(28000):用户“账单”@“localhost”(使用密码:YES)的访问被拒绝
I discovered yet another case that appears on the surface to be an edge case; I can export to the file system, via SELECT INTO .. OUTFILE as root, but not as regular user. While this may be a matter of permissions, I've looked at that, and see nothing especially obvious. All I can say is that executing the query as a regular user who has all permissions on the data base in question returns the access denied error that led me to this topic. When I found the transcript of a successful use of SELECT INTO … OUTFILE in an old project, I noticed that I was logged in as root. Sure enough, when I logged in as root, the query ran as expected.
MySQL account names consist of a user name and a host name, The name 'localhost' in host name indicates the local host also You can use the wildcard characters “%” and “_” in host name or IP address values. These have the same meaning as for pattern-matching operations performed with the LIKE operator. For example, a host value of '%' matches any host name, whereas a value of '%.mysql.com' matches any host in the mysql.com domain. '192.168.1.%' matches any host in the 192.168.1 class C network.
以上只是介绍:
实际上,用户“bill”@“localhost”和“bill”@“%”是不同的MySQL帐户,因此两者都应该使用自己的身份验证细节,如密码。
欲了解更多信息,请参阅http://dev.mysql.com/doc/refman//5.5/en/account-names.html