MySQL Forums
Forum List  »  Security

mysql root user recovery
Posted by: Edward Lassotovitch
Date: October 26, 2010 02:44PM

THANKS TO WOOZLE!

/etc/init.d/mysql stop
/usr/bin/mysqld_safe --skip-grant-tables &

mysql -u root
use mysql;
INSERT INTO `mysql`.`user` (`Host` , `User` , `Password` , `Select_priv` , `Insert_priv` , `Update_priv` , `Delete_priv` , `Create_priv` , `Drop_priv` , `Reload_priv` , `Shutdown_priv` , `Process_priv` , `File_priv` , `Grant_priv` , `References_priv` , `Index_priv` , `Alter_priv` , `Show_db_priv` , `Super_priv` , `Create_tmp_table_priv` , `Lock_tables_priv` , `Execute_priv` , `Repl_slave_priv` , `Repl_client_priv` , `Create_view_priv` , `Show_view_priv` , `Create_routine_priv` , `Alter_routine_priv` , `Create_user_priv` , `ssl_type` , `ssl_cipher` , `x509_issuer` , `x509_subject` , `max_questions` , `max_updates` , `max_connections` , `max_user_connections` )VALUES ('%', 'root', PASSWORD( '' ) , 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', '0', '0', '0', '0');
exit

/etc/init.d/mysql stop
/etc/init.d/mysql start
This did the trick for me without having to backup any databases and without reinstalling the server.

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql root user recovery
5915
October 26, 2010 02:44PM
1998
January 19, 2011 09:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.