Bug #78019 ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
Submitted: 11 Aug 2015 11:19 Modified: 12 Aug 2015 13:29
Reporter: Sambasiva Rao Narra Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5.45 OS:Linux
Assigned to: CPU Architecture:Any

[11 Aug 2015 11:19] Sambasiva Rao Narra
Description:
Not allowing to perform create, drop, grant operations on a user and getting below error even when logged in as root user.

mysql> SHOW GRANTS FOR jiradbuser@'sg70xuweb001.zap.alcatel-lucent.com';
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql> 

Below are the users and the grants info:

mysql> select user ();
+----------------+
| user ()        |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> select current_user ();
+-----------------+
| current_user () |
+-----------------+
| @localhost      |
+-----------------+
1 row in set (0.00 sec)

mysql> show grants;
+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)

mysql> 

Can you please help me on this.

Thanks,
Sambasiva Rao.N

How to repeat:
You can rename root user to some other user like as below and try executing the commands like create, drop and grant then will see the issue.

RENAME USER 'root'@'localhost' TO 'apache'@'127.0.0.1';
[11 Aug 2015 18:25] MySQL Verification Team
Hi,

Thank you for your bug report. You have asked a question about a behavior that is expected, but it is not at all documented. There is no mention in the manual of what happens when you apply the RENAME USER command on the 'root' user.
[12 Aug 2015 13:29] Paul DuBois
Bug report says: "Not allowing to perform create, drop, grant operations on a user and getting below error even when logged in as root user."

But in fact, the client program is connected as an anonymous user, not as root. This can be seen from the first error message:

mysql> SHOW GRANTS FOR jiradbuser@'sg70xuweb001.zap.alcatel-lucent.com';
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

The user name of '' there indicates "anonymous user".

That is seen by the results from these two queries as well:

mysql> select current_user ();
+-----------------+
| current_user () |
+-----------------+
| @localhost      |
+-----------------+
1 row in set (0.00 sec)

mysql> show grants;
+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)

This is similar to what is described at:
http://dev.mysql.com/doc/refman/5.6/en/connection-access.html
beginning at:
"If you are able to connect to the server, but your privileges are not what you expect..."