Forgot password solution after installing Mysql under Ubuntu

Forgot password solution after installing Mysql under Ubuntu


first step:

cd /etc/mysql


Step 2:

sudo vim debiancnf


third step:

If the username in debian.cnf is debian-sys-maint, enter:

mysql -u debian-sys-maint -p Enter carriage return,

At this time, you need to enter the password, copy the password in debian.cnf (do not enter it manually, because it is easy to make mistakes)

At this point, I entered MySQL.


the fourth step:

To change the root password, enter:

use mysql;

update user set password=password('新密码') where user='root';

flush privileges;

quit


the fifth step:

Log in with the newly changed root and password to view.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325585630&siteId=291194637