MySQL Database Password modification

Source: Internet
Author: User
This method is available for unknown database password or initial login:
If you change the password, you should stop the MySQL service first.
Systemctl Stop Mysqld

1 Modify the configuration file, skip the password to enter the database
Vim/etc/my.cnf
[Mysqld]
Skip-grant-tables
Restart Service:
Systemctl Restart Mysqld
Enter the database:
Mysql
To view the database table structure:
Desc Mysql.user;
Set Database login Password

Update Mysql.user Set Authentication_string=password ("123456");

Exit
Quit
Modify the configuration file again, comment out the skipped password, then write two lines
[Mysqld]
#skip-grant-tables
Validate_password_policy=0
Validate_password_length=6

Restart Service
Systemctl Restart Mysqld
Log in to the database with a set password
mysql-uroot-p123456

show databases;
The user is required to write the password again at this time
Set password for [email Protected]=password ("123456");

Exit
Quit
Re-entry
mysql-uroot-p123456
The database is working correctly:
show databases;

MySQL Database Password modification

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.