When I try to connect the MySQL Server by command:
mysql -u root -p
I get error "Access denied". I'm sure that the password is right.
When I use the
mysqld --defaults-files "xxx\my.ini" --console --skip-grant-tables
option, I can access in, but when I quit this, access is denied again.
How could I sovle it?
You can reset the root password.
For MySQL 5.7.6 and later:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
This can be dangerous, read the full official instructions before: How to Reset the Root Password?