Solve ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

使用Linuxhost willVestaCPPanelMySQL databaseUpgrade to Mariadb version 10.4.6.

Solve ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Unexpectedly, enter the following command▼

mysql -uroot -p
  • Enter password to log inmysql.

The following error occurs ▼

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Usually this error is caused by wrong root user password for MySQL data, the solution is of course to reset the password.

How to MySQL ERROR 1045 (28000) error?

Step 1:use SSHsoftwareAfter logging in, enter the following command to stop the mysql database ▼

systemctl stop mysqld

Step 2:Start MySQL with the following command and start it without checking permissions ▼

mysqld --skip-grant-tables &

At this point, another error was reported ▼

[ERROR] Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root!

Please SSH and enter the following command ▼

mysqld --user=root --skip-grant-tables &

Step 3:SSH login to mysql ▼

mysql -uroot

Or

mysql

Step 4:update root password

Mysql5.7 or later ▼

UPDATE mysql.user SET Password=PASSWORD('123456') where USER='root';

Mysql5.7 version ▼

UPDATE mysql.user SET authentication_string=PASSWORD('123456') where USER='root';

Step 5:Refresh permissions ▼

flush privileges;

Step 6:exit mysql ▼ 

exit

Or

quit

Step 7:Re-login to mysql with the root user ▼

Mysql -uroot -p
  • Enter password:<输入刚改好的密码123456>

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "Solving ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)", which is helpful to you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-1094.html

Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!

🔔 Be the first to get the valuable "ChatGPT Content Marketing AI Tool Usage Guide" in the channel top directory! 🌟
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

scroll to top