• notice
  • Congratulations on the launch of the Sought Tech site

LinuxMysql Forgot a variety of solutions or accessdeniedforuser'Root '@' localhost '

My system is ubuntu6.06.Recently installed mysql is in mysql tool, there is always an error message:
# mysql-uroot-p
Enter password:
ERROR 1045 (28000) : Access denied for user'root'@'localhost' (using password: NO)
Use the method introduced on the Internet to modify the password of the root user:
# mysqladmin-uroot-p password ' newpassword'
Enter password:
mysqladmin: connect to server at'localhost' failed
error:'Access denied for user'root'@'localhost' (using password: YES)'
Now finally I found a solution, as follows (please test method three first, thank you!):
Method 1:
#/etc/init.d/mysql stop
# mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
# mysql-u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' ;
mysql> FLUSH PRIVILEGES;
mysql> quit
#/etc/init.d/mysql restart
# mysql-uroot-p
Enter password: <Enter the new password newpassword>
mysql>

Method 2:
Direct Use the username and password provided in the [client] section of the/etc/mysql/debian.cnf file:
# mysql-udebian-sys-maint-p
Enter password: <Enter the password for the [client] section> ;
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql-uroot-p
Enter password: <Enter the new password newpassword>
mysql>

Method 3:
I have not tested this method because I am root user The default password has been modified by me.Whoever has time to test it and tell me the result, thank you! !
# mysql-uroot-p
Enter password: <Enter the password provided in the [client] section of the/etc/mysql/debian.cnf file>
At this point, the problem of long confusion has been solved!

Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

buy lipitor 20mg generic & lt;a href="https://lipiws.top/"& gt;purchase lipitor generic& lt;/a& gt; atorvastatin 10mg without preion

Riqvmt

2024-03-07

Leave a Reply

+