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 is a detailed tutorial on setting passwords for the MySQL free installation version introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time! You may also be interested in:
|
<<: Methods for optimizing Oracle database with large memory pages in Linux
>>: Canvas draws scratch card effect
Suppose there is a table: reward (reward table), ...
According to Chinese custom, we are still celebra...
Stored Procedures 1. Create a stored procedure an...
As a tester, you may often need to install some s...
Today, I will record how to install MySQL 8.0.18 ...
Prerequisites for installing MySQL: Install CentO...
Form submission code 1. Source code analysis <...
How to write join If you use left join, is the ta...
Prometheus (also called Prometheus) official webs...
Why should we read the log? For example, if the c...
Directory Structure . │ .env │ docker-compose.yml...
The previous article on Docker mentioned the cons...
<br />Information duplication, information o...
1. Download the latest nginx docker image $ docke...
1. Overview MySQL version: 5.6.21 Download addres...