How MySQL modifies the password

Source: Internet
Author: User
Tags mysql command line phpmyadmin

There are many ways to change the root password, let me summarize some common MySQL data to modify the root password method, there is a need to know or forget the root password of friends can enter the reference.

method One , with Mysqladmin


Here you use the two commands that come with MySQL Mysqladmin.exe and mysql.exe,mysqladmin change the password command format as follows

- -P[oldpass] password newpass

Note Oldpass (old password) optional, if the root default password is empty, you do not need to enter, if you need to change the old password, please note that the old password and-p do not have a space, otherwise will be error, the other password and newpass (new password) separated by a space.

- u rootmysql > SET  for ' Root '@'localhost'= PASSWORD ('newpass' );

method Two : In DOS mode (CMD mode) Navigate to the MySQL installation directory in the subdirectory bin, call Mysql.exe to enter, i.e.

5. 1bin>--******

Use the Mysqladmin.exe command to modify the root password of MySQL

General MySQL root default password is empty, if you have not set the root password before using the Mysqladmin command, you can use the following mysqladmin command to modify the root password

5. 1bin>--1234565. 1bin>- -p123456

As described above using mysqladmin to first modify the root's default password, enter password enter, and then use the Mysql.exe command to enter root and its password to enter the MySQL command line.

If Root has already set a password, use the following method

mysqladmin -u root password oldpass "newpass"

Method 3: Edit the user table directly with update

- u rootmysql >  Use Mysql;mysql > UPDATE User SET = PASSWORD ('newpass'WHEREuser=' Root ' ; MySQL > privileges;

This can be done when the root password is lost

-- skip-grant-tables& - u root mysqlmysql > UPDATE User SET Password=WHEREuser='root' ; MySQL > privileges;

Using phpMyAdmin to change the root password of MySQL is very convenient, installation configuration phpMyAdmin after the first login management interface, click on the right to change the password link, enter the MySQL root new password you want to modify, finally click to execute

Original address: http://www.manongjc.com/article/113.html

How MySQL modifies the 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.