HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

MySQL - grant all privileges on *.* brings back Access denied

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
allprivilegesbringsgrantdeniedbackmysqlaccess

Problem

GRANT ALL PRIVILEGES ON *.* TO  'username'@'localhost'  IDENTIFIED  BY  'somepassword';


Brings back error :

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


If I give a database name it works.

GRANT ALL PRIVILEGES ON dbname.* TO  'username'@'localhost'  IDENTIFIED  BY  'somepassword';


I did select from user where user ='root'; and it has Y under every _priv column.

I'm running MySQL Server version: 5.5.38. Does anyone know why this is happening?

Solution

For those who still stumble upon this like I did, it's worth checking to make sure the attempted GRANT does not already exist:

SHOW GRANTS FOR username;


In my case, the error was not actually because there was a permission error, but because the GRANT already existed.

Code Snippets

SHOW GRANTS FOR username;

Context

StackExchange Database Administrators Q#72654, answer score: 3

Revisions (0)

No revisions yet.