Access denied for user ‘root‘@‘localhost‘ (using password: YES)

ubuntu mysql password is wrong

sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]

Add the next line to skip password verification

skip-grant-tables

Restart mysql

/etc/init.d/mysql restart

Then enter mysql in the terminal

mysql> use mysql;
mysql>update mysql.user set authentication_string=password('123456') where user='root';
mysql> flush privileges;
mysql> quit

The new password at this time is 123456

Then go to /etc/mysql/mysql.conf.d/mysqld.cnf

Remove skip-grant-tables

Then type

mysql -u root -p

 

Guess you like

Origin blog.csdn.net/qq_16792139/article/details/113615438