MySQL Access denied

reset password for Linux ERROR 1045 (28000): Access denied for user ‘root’ @’ localhost ‘(using password: YES)
usually this ERROR is caused by a password ERROR, so the solution is naturally to reset the password.

suppose we are using a root account.

1. The first step to reset your password is to skip the MySQL password authentication process as follows:

#vim /etc/my.cnf(note: my.ini is modified under Windows)

search mysqld within the document to locate the [mysqld] text segment:
/mysqld(directly enter this command to search text content in vim edit state)

add “skip-gran-tables” on any line after [mysqld] to skip the password verification process, as shown in the figure below:


save the document and exit:

#:wq

2. Next we need to restart MySQL:

/etc/init.d/mysql restart(some users may need to use /etc/init.d/mysqld restart)

3. After a reboot enter #mysql to enter mysql.

4. The next step is to use SQL to change root’s password

mysql> use mysql;
mysql> Update user set password=password(” your new password “) where user= “root”;
mysql> flush privileges;
mysql> quit

is where the root account has been reset to the new password.

5. Edit my.cnf to remove the content you just added, and then restart MySQL. There we go!

Read More: