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:
- MYSQL login error: mysqladmin: connect to server at’localhost’ failed
- [error handling] when logging into MySQL with CentOS command, an error 1045 (28000) is reported
- Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root!
- Linux-mysql8.0 password reset problem – error 1396 (HY000): Operation alter user failed for ‘root’ @’localhost ‘
- MySQL password setting error message: error 1054 (42s22): unknown column ‘password’ in ‘field list’
- Error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: no)
- MySQL startup problem (ERROR 1045 (28000): Access denied for user’ODBC’@’localhost’ (using password: NO))
- MySQL forgot the root password
- MySQL error — multiple methods of failed to find valid data directory and MySQL setting password appear
- Error 1045 (28000): solution to access denied for user ‘root’ @’localhost ‘(using password: no)
- Navicat for MySQL error 1251 failed to connect to MySQL
- After installing MySQL again under Linux, the solution of ‘MySQL module failed to start’ appears
- Remote connection MySQL error 1045 solution
- Solve MySQL error 1698 (28000): access denied for user ‘root’ @’localhost ‘
- Solve the problem of MySQL 1251 client does not support
- Error 1045 (28000) access denied for user ‘root’ @’localhost ‘appears in MySQL under Windows system
- ERROR 1045 (28000): Access denied for user’ODBC’@localhost (using password: NO)209150;’211503;’
- ERROR 2000 (HY000): Unknown MySQL error
- Redirecting to /bin/systemctl stop mysqld.service
- After the two hosts set up the master-slave replication of MySQL, the show slave status displays: last_ IO_ Error: error connecting to master ……