Method 1: Use the SET PASSWORD command MySQL -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); Method 2: Using mysqladmin mysqladmin -u root password "newpass" If the root password has been set, use the following method mysqladmin -u root password oldpass "newpass" Method 3: Use UPDATE to edit the user table directly mysql -u root mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES; When you lose your root password, you can mysqld_safe --skip-grant-tables& mysql -u root mysql mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root'; mysql> FLUSH PRIVILEGES; The above are the various methods of changing the root password of MySQL that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Native JavaScript implementation of progress bar
>>: How to use Docker container to access host network
Overview This article begins to introduce content...
Author: Guan Changlong is a DBA in the Delivery S...
Wildcard categories: %Percent wildcard: indicates...
Table of contents 1. Build basic styles through E...
introduction I used postgresql database for some ...
1.MySQL UPDATE JOIN syntax In MySQL, you can use ...
The drag function is mainly used to allow users t...
To create a flex container, simply add a display:...
I joined a new company these two days. The compan...
Table of contents What is recursion and how does ...
This article example shares the specific code of ...
Preface I have an old laptop with Win7. In order ...
This article mainly explains how to install the M...
Preface: During database operation and maintenanc...
Table of contents 1. Tool Introduction 2. Workflo...