The root user name in ubuntu cannot go to mysql. how can I view the user name and password, and how can I modify the root password in Ubuntu?
Mysql-u root-p press Enter. after entering the password, the system prompts "access denied... ues password YES/NO" error.
Step 1:
In this case, you need to enter the/etc/mysql directory, and then sudo vim/vi debian. cnf view the username and password in the file, and then use the username and password in the file to enter mysql. if debian. if the user name in cnf is debian-sys-maint, then:
Mysql-u debian-sys-maint-p press Enter. in this case, you need to enter the password and copy the password in debian. cnf (do not enter it manually because it is prone to errors ).
Now you can access mysql.
Step 2:
Change root password
Log on to the mysql client according to the previous step.
Mysql> use mysql;
Database changed
Mysql> update user set password = password ('New password') where user = 'root ';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql> quit
Step 3:
Use the newly changed root and password to log on and view.