DWQA QuestionsCategory: DatabaseThe problem of setting passwords for MySQL root users
jollywing asked 4 weeks ago

I want to give it to you today.mysqlThe root user adds a password and executes in MySQL according to the online tutorials:

mysql> update mysql.user set password='567890' where User='root';

Explicit success.
After restarting mysqld, I usedmysql -uroot -p'567890'Landing, result landing does not go in

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

Ask your brothers to help you see what is the reason and how to solve it.

1 Answers
Best Answer
silenceper answered 4 weeks ago

The password is encrypted (using the PASSWORD function):update mysql.user set password=PASSWORD('567890') where User='root';

Oishi replied 4 weeks ago

Stop the Mysql service and start with mysql_safe with the command of / usr/bin/mysqld_safe — skip-grant-tables &, then log in without a password.