Mysql Database Password Management

Source: Internet
Author: User

Mysql Database Password Management


1, password is empty when set password is 123456:

mysqladmin-u root password ' 123456 '


2, know the existing password, need to change the password to 123123:

2.1, the first method of setting

Mysql-u root-p123456

mysql> use MySQL;

mysql> Update user Set Password=password (' 123123 ') where user= "root";

mysql> flush Privileges;


2.2, the second method of setting

mysqladmin-u root-p password ' 123123 '

Enter the old password


3, MySQL forgot password, crack set a new password

[Email protected] ~]# mysql-u root-p12345678

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)


To stop the database:

[[Email protected] ~]# service mysqld stop

Shutting down MySQL. Determine

[[email protected] ~]# netstat-anptu |grep MySQL

Skip Authorization Form

[Email protected] ~]# Mysqld_safe--skip-grant-tables &

[[email protected] ~]# MySQL


mysql> use MySQL;

mysql> Update user Set Password=password (' ABCD ') where user= "root";

mysql> flush Privileges;

Mysql> exit


[[Email protected] ~]# service mysqld stop

[[Email protected] ~]# service mysqld start


Connect a test with a new password

[Email protected] ~]# mysql-u root-p123123

This article is from the "Crushlinux" blog, make sure to keep this source http://crushlinux.blog.51cto.com/2663646/1539395

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.