Question

I may be asking for the impossible here. I just tried to reset my password in phpMyAdmin. In order to do that it creates a new user with the new password and gives you the option to delete the old user. I selected to delete the old user and create a new user with the same permissions.

Then phpMyAdmin kicked me out. So I assumed that was because I needed to log in with my new password. I tried several times and it wouldn't let me in.

So I logged in as root using command line (mysql -u root -p). I was able to log in and saw that my original user was in fact not there. So I created the user again and tried to grant all privileges to that user and got:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'me'@'localhost' WITH GRANT OPTION;
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Then I checked the GRANTS for user root and saw:

mysql> show grants for current_user();
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, 
FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, 
LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, 
SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* 
TO 'root'@'localhost' IDENTIFIED BY PASSWORD 'blah' WITH GRANT OPTION

To me it looks like I don't have permission to GRANT permission with my root user. I may have set that at one point for security.

Basically I don't think there is a user in the DB with permission to GRANT ALL PERMISSIONS anymore. Can I restore this?!?! PLEASE HELP?!? Do I need to create a new mysql instance?

Was it helpful?

Solution

It looks like you may some misalignment of grants. Why do I say this ???

I have dealt with grant table issues before in the DBA StackExchange

If you look at the first link, I display all the layouts for mysql.user from MySQL 5.6 back to MySQL 4.1.

Apparently, it looks like you did an upgrade of MySQL without fixing mysql.user.

Hopefully you could run

# mysql_upgrade --upgrade-system-tables

to realign mysql.user and have it autofill missing permissions with Y.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top