MySQL 5.7 How to change the default password, random password

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.