Home > database >  The MySQL password change
The MySQL password change

Time:09-23

Haven't logged in mysql, the root password==forget database, on the Internet to find a lot of reset the root password blog, due to record those blog search mysql version is too old to method cannot be used, helpless, I had to delete reinstall mysql, but somehow after reshipment or need password, before it exploded mentality, consult friend, eventually found the secret password reset mysql method, free in the record,

My system is Fedora25, MySql version is 5.7,
Change the password as follows:
1. In the configuration file/etc/my. Add skip CNF - grant - tables, so that we can avoid close login mysql,

Sudo vim/etc/my CNF

Save and exit,

2. Restart the mysql

Systemctl restart mysqld
Or
Service mysqld restart

3. The input terminal mysql login the mysql database directly, and then use the mysql

Mysql
Success into mysql
Mysql> The use of mysql

4. Reset the root password
It is important to note that under the mysql5.7 version, this field has no password, the password field changed authentication_string, change passwords, we are going to modify the value in this field,

Update the user set authentication_string=password (' new password ') where the user='root';

1

In this way, we will have to amend the password successfully,
. 5. Modify the/etc/my CNF file, add before the skip - grant - tables this sentence commented out, or we're still free login Mysql secret way,

6. Restart mysql again

Systemctl restart mysqld
Or
Service mysqld restart

Finished, mission accomplished,

CodePudding user response:

CodePudding user response:

Can also download a phpStudy software, in Chinese, provides the mySql commonly used functions, including strong change password,
Overall feeling is good, can try,

CodePudding user response:

Much, little buddy

CodePudding user response:

You can try
  • Related