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:
- ER_ACCESS_DENIED_ERROR: Access denied for user ‘root‘@‘localhost‘ (using password: NO)
- Solve MySQL error 1698 (28000): access denied for user ‘root’ @’localhost ‘
- MySQL startup problem (ERROR 1045 (28000): Access denied for user’ODBC’@’localhost’ (using password: NO))
- Solve net start mysql, start MySQL service, prompt system error 5. Access denied.
- Error 1045 (28000) access denied for user ‘root’ @’localhost ‘appears in MySQL under Windows system
- MySQL connection error access denied for user ‘root’ @ ‘localhost‘
- ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘mysql’
- System error 5 occurred in net start mysql. Access denied)
- Springboot uses druid to log in MySQL. An error occurred: access denied: errorcode 1045, state 28000
- 【docker】 denied: requested access to the resource is denied
- Error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: no)
- Error 1045 (28000): solution to access denied for user ‘root’ @’localhost ‘(using password: no)
- HTTP Basic: Access denied
- git remote: HTTP Basic: Access denied error resolution
- Idea access denied for user ‘xxx’ @ ‘localhost’ solution
- ERROR 1045 (28000): Access denied for user’ODBC’@localhost (using password: NO)209150;’211503;’
- Error in Git operation: http basic: access denied solution
- Git report HTTP Basic: Access denied
- Error code 1045, state 28000, Java sql.SQLException :Access denied for user ‘root’@’localhost’
- openservice ERROR_ACCESS_DENIED