When WordPress meet “Access denied for user ‘root’@’localhost'”

In my case , the key is ubuntu mysql default password. When i use “sudo mysql”, will login the mysql without any password or username.

But i use command “sudo mysql_secure_installation” to change the password , it doesn`t work!

After use below command

UPDATE mysql.user
SET authentication_string=PASSWORD(‘your password’),
plugin=’mysql_native_password’
WHERE User=’root’ AND Host=’localhost’;

The error finally solved.