Using mysql -uroot -p, and then entering a password to log in to mysql, the following error occurs:
ERROR 1045 (28000): Access denied for user 'root' slocalhost' (using password: YES)
Generally this error is caused by a password error, the solution is naturally to reset the password
The solution is as follows:
1. Stop mysql database: systemctl stop mysqld
2. Start MySQL with the following command and start it without checking permissions:
mysqld --skip-grant-tables
Another error was reported: 2018-02-01T02:52:55.093724Z 0 smh.com.au to run mysqld as root!
Execute commands: mysqld --user-root--skip-grant-tables-tables
3. Login mysql:mysql -uroot or mysql
4. Update root password
mysql5.7 the following version: UPDATE mysql.user SET Password s password ('123456') where USER 'root';
mysql5.7 version: UPDATE mysql.user SET s-s-s-string-PASSWORD ('123456') where USER-'root';
5. Refresh permission: flush privileges;
6. Exit mysql:exit or quit
7. Re-login mysql with root user
mysql -uroot -p
Enter the new password 123456
————————————————
评论专区