When you log in to MySQL using Mysql-u root-p, you are prompted to enter your password below. And this password is not the one we set when we just installed MySQL. and install the random password generated by MySQL
So where do we find this random password and change it to our own password?
1.data catalog is missing.
First we enter the C:\Program files\mysql\mysql Server 5.7 installation directory to see if there is a data folder. If not, then use MySQL
2. Randomly generated a random string as the password
At this point, you see that the Data folder has been generated under the path to the server. Found a file with a suffix of. err
Open, use CTRL +f find password to find out what this random password is.
localhost: After the generated random password, copy it down, then go to the cmd interface and go back to the step to enter the password
Paste. Enter
Landing success
Enter the command to modify the random password:
3. Instructions for changing the password
Sure enough, the instructions for changing the password in the new version are not so easy to find.
After the successful connection, using the SQL statement modification, the past is not logged in the state of the modification method is no longer available ~ ~
Mysql>ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘new_password‘
;
Modification succeeded:
MySQL 5.7 How to change the default password, random password