Recovering MySQL access
Okay, let's say you didn't have your coffe this morning, and because of this 'lack-of-fuel' you messed the 'mysql' database (specially users table'. All your clients are complaining, because they are not able to connect anymore, your phone rings like a hell.
Think fast! 1 shutdown your mysql server, 2 bring it up without grant handling and no network, 3 restore your last backup (I really hope you have a backup), 4 shutdown the server again, 5 start the service as usual.
in another words,
1 kill the pid of mysqld (or mysqld-nt.exe) (since mysqladmin won't work)
2 mysqld (or mysqld-nt.exe) --skip-grant-tables --skip-network
3 mysql -u root mysql < your_last_mysql_backup.sql
4 mysqladmin shutdown
5 start your mysql server as usual
If it worked, you are safe. Go get your coffee man!
My name is André and I'm 27 years old. I've been working in various areas of IT in the last years and this blog is about the most interesting things I found into my day after day... See more