Before I screw up something, when I login using $ mysql -u root -p
, and show databases:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| game_data |
| test |
+--------------------+
Then I tried to create a new user and notice something is wrong with the PRIVILEGES.
So I deleted the new users, and I guess I removed the 'root' and 'Admin' accidentally.
Then I try to create 'root' again, but get Access denied error when doing grant all privileges.
mysql> CREATE USER 'root'@'localhost' IDENTIFIED BY 'password';
mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'password' with grant option;
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
If I login to MySQL again using $ mysql -u root -p
, and show databases,
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
All the other databases are gone.
How do I fix MySQL now?
I cannot find the database 'mysql', cannot create database, create user, anything I try to do will get an error.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).
Should I reinstall MySQL using MacPorts? If reinstall, I will lose the database game_data
, right?
-p
and the password. I know its silly but might help someone.