1

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?)

Community
  • 1
  • 1
Emmet B
  • 5,341
  • 6
  • 34
  • 47
  • Check this : http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html – Sunil Gulabani Apr 12 '13 at 06:15
  • 1
    the problem with that is when I kill mysqld.pid, it immediately starts another one. thus `sudo mysqld_safe --init-file=initfile` gives `mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect. mysqld_safe Logging to '/var/log/mysql/error.log'. mysqld_safe A mysqld process already exists` – Emmet B Apr 12 '13 at 06:21
  • What OS are you running? – Alvin Wong Apr 12 '13 at 06:23

0 Answers0