Step 1: enter the directory: CD / etc / MySQL, and view the debian.cnf file
Step 2: log in to MySQL using the account and password in the figure above.
Step 3: view the library in the database.
Step 4: use MySQL library.
Step 5: use the following statement to set the account password:
update user set authentication_ String = password ("user defined new password") where user ='root ';
My personal settings are simple. The account number is: root. Password: 123456
Step 6: execute the following statement:
update user set plugin="mysql_native_password";
Step 7: refresh:
Step 8: Exit: quit;
Step 9: change the password. Type in the command box
：/etc/init.d/mysql restart;Restart MySQL
Last step: log in again. Congratulations on changing your default password.
The above is Xiaobian’s introduction to the steps of installing MySQL in Ubuntu and changing the default password. I hope it can help you. If you have any questions, please leave me a message and Xiaobian will reply you in time. Thank you very much for your support to developer!
If you think this article is helpful to you, please reprint, please indicate the source, thank you!