Mysql change root password _ MySQL

Source: Internet
Author: User
Method 1: Use phpmyadmin. this is the easiest way to modify the user table of the mysql database. do not forget to use the PASSWORD function. Method 2 use mysqladmin, which is a special case stated above. Mysqladmin-uroot-ppasswordmypasswd enter this command and then enter root method 1.

Phpmyadmin is the simplest way to modify the user table of the mysql database.

But don't forget to use the PASSWORD function.

Method 2

Mysqladmin is a special case stated above.

Mysqladmin-u root-p password mypasswd

After entering this command, enter the original root password and change the root password to mypasswd.

Change the root in the command to your username and you can change your password.

Of course, if your mysqladmin cannot connect to mysql server or you cannot execute mysqladmin

This method is invalid.

In addition, mysqladmin cannot clear the password.

The following methods are used at the mysql prompt and must contain

Method 3

Mysql> insert into mysql. user (Host, User, Password)

VALUES (%, jeffrey, PASSWORD (iscuit ));

Mysql> FLUSH PRIVILEGES

Specifically, this is when a user username is added as jeffrey and the password is biscuit.

So I wrote this example.

Use the PASSWORD function and then use flush privileges.

Method 4

The REPLACE statement is used in the same way as method Sany.

Mysql> replace into mysql. user (Host, User, Password)

VALUES (%, jeffrey, PASSWORD (iscuit ));

Mysql> FLUSH PRIVILEGES

Method 5

Use the set password statement

Mysql> set password for jeffrey @ "%" = PASSWORD (iscuit );

You must also use the PASSWORD () function.

However, you do not need to use flush privileges.

Method 6

Use the GRANT... identified by statement

Mysql> grant usage on *. * TO jeffrey @ "%" identified by iscuit;

Here, the PASSWORD () function is unnecessary and does not need to use flush privileges.

Note that PASSWORD () [not] implements PASSWORD encryption in the same way as Unix PASSWORD encryption.

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.