About the modification of MySQL8.0 password (Xiaobai)

Toss for a long time, make a summary:
About MySQL8.0:
1. When searching on the Internet, you must remember to type the version number of 8.0, otherwise all you find are the password modification methods of the previous version.
2. MySQL default root has no password, that is Say input in cmd: "mysql -uroot -p" can be directly entered, and the following "ENTER PASSWORD:" can also be entered directly, if you don't remember to set it yourself, you can try it
3. Modify the password through NaviCat The method:
Insert picture description here
(this is seen on the forum, the pro-test is valid)
4. The way to modify the password through cmd:
Steps: 1. First enter the database
Insert picture description here
2. Input: use mysql;
Insert picture description here
3. Input: ALTER USER'root'@' localhost' IDENTIFIED WITH mysql_native_password BY "password (the new password you want to set)";
Insert picture description here
4. select user, authentication_string from user;
(If you see the table below, and if your original password is empty, and the table is marked If it is not empty, it means that the modification is successful!!)
Insert picture description here
5. flush privileges; (required)
6. quit;
Insert picture description here

At this step, if there is no ERROR, and every step is the same as mine, congratulations, you have changed it!

You can try to enter the database with a new password
Insert picture description here

PS: If you forget your password, just take a look

https://www.cnblogs.com/ttxcs/p/11614391.html

For the tips of this big guy, you can stop the MySQL service and enter the database directly without a password, and then change the password according to my above method

Guess you like

Origin blog.csdn.net/weixin_45729934/article/details/105965570