I'm trying to recover the deleted root account.
I followed this Restoring deleted 'root' user and password for MySQL (also the blogger link there)
everything is fine until I try
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
which gives
ERROR 1045 (28000): Access denied for user ''@'localhost' (using password: NO)
I don't know what password I should put mysql -u root -p
. I think I am being logged as user: ''. How can I delete this user? When I enter my previous root password, it does not accept. I just dont type any password, press enter and it accepts.
When I do this SELECT USER(),CURRENT_USER();
it says:
+----------------+----------------+
| USER() | CURRENT_USER() |
+----------------+----------------+
| root@localhost | @localhost |
+----------------+----------------+
1 row in set (0.00 sec)
How can I fix this? (or: How can I delete root and add again and set a password?)