MySQL Forums
Forum List  »  Newbie

Re: Accidentally delete 'root' account
Posted by: Tanveer Malik
Date: May 31, 2022 09:33AM

this is what did the trick for me, I am sharing it here as it may help someone else
https://stackoverflow.com/questions/72444767/restoring-deleted-root-user-for-mysql-v8-0-28/72447294#72447294

Credit to @Fatiha, it actually was her [?] idea which started to put the things in place.

I created a SQL File, InitFile.sql, with the contents as given below

UPDATE mysql.user set Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', Index_priv='Y', Alter_priv='Y', Show_db_priv='Y', Super_priv='Y', Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y' WHERE User='tanmalik786'; FLUSH PRIVILEGES;

2.Added this line just below [wampmysqld64] section

init-file=d:/wamp64/bin/mysql/mysql8.0.28_1/bin/InitFile.sql
Kept examining the mysql.log file, to see for the errors and using mysqld from an Administrator Shell to check for the Privileges.

It Worked!

Finally I am able to retrieve all my hidden users including 'root' and all the databases are once again accessible to me, Thanks @Fatiha Once more!

After testing it, I still feel there are some privilege issues BUT since I am able to access the databases so am able to export the scripts and import into the other installation so I'm happy.

Thanks for your help!

Options: ReplyQuote




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.