Set root password above MySql8.0

Set root password above MySql8.0

Since mysql8.0 and later versions removed the previous built-in password method, the previous password setting tutorial is invalid. Need to adopt a new method
1. Open cmd.exe with administrator privileges, enter the net stop mysql command to stop the current mysql service
insert image description here
2. Start the mysql service without setting permissions:
insert image description here
3. Re-open cmd with the administrator. Enter mysql -uroot -p Log in with root, and press Enter when prompted to enter the password.
insert image description here
4. After entering mysql, switch to the mysql database:
insert image description here
5. Change the field "authentication_string" in the user table in the mysql database to ""
insert image description here
6. At this time, because of the use of – Skip-grant-table login, all, you can’t change the root password yet, the programmer switches off the global read-only status:
insert image description here
Change the read-only attribute:
insert image description here
Refresh permissions:
insert image description here
7. Now you can enter your new root password
insert image description here

Guess you like

Origin blog.csdn.net/zhush_2005/article/details/107680572