Reputation: 83
Using mysql.exe
, I enter the command mysql> use mysql;
but there is an error:
ERROR 1044 (42000): Access denied for user '' @ 'localhost' to database 'mysql'
mysql> use mysql;
.Upvotes: 0
Views: 50881
Reputation: 1
I got the same error below:
ERROR 1044 (42000): Access denied for user 'john'@'localhost' to database 'mysql'
When I tried to select mysql database(schema) by login with the user john
as shown below:
use mysql
So, I gave all privileges on all the tables in mysql
database(schema) (mysql.*
) to the user john
with GRANT by login with the user root
as shown below, then I could solve the error:
GRANT ALL ON mysql.* TO 'john'@'localhost';
Or:
GRANT ALL PRIVILEGES ON mysql.* TO 'john'@'localhost';
Upvotes: 0
Reputation: 1
Open MySQL interface (phpMyadmin) through browser then
Upvotes: -1
Reputation: 83
thanks all, finally I found this reset root password with wrong mysql config… and it works well for me :)
-Go to your xampp\mysql\bin\ folder
-Edit my.ini and insert skip-grant-tables below [mysqld]
-Restart MySQL
-Set new password for your root user by running UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root' in phpMyAdmin in the mysql database (or just leave it like this if MySQL cannot be accessed from remote hosts)
AndreKR
Upvotes: 6
Reputation: 2998
Grant all privileges to the user first ,
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
Upvotes: 2