How Windows modifies the MySQL user root password

Source: Internet
Author: User

Listen to the Voice
    • Browse:16925
    • |
    • Updated: 2015-06-12 14:49
    • |
    • Tags:windows
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
Step through Reading

MySQL is a relational database management system, and MySQL is one of the best RDBMS (relational database Management system, relational data management systems) application software in WEB applications. With PHP and Apache to form a good development environment. Therefore, it is widely used. Many people will encounter MySQL needs to change the password, such as the password is too simple, forget the password and so on. Here I will teach you several ways to modify the MySQL password. Here, for example, change the root password, the operating system is windows.

To declare a point, in most cases, to modify MySQL is required to have root permissions in MySQL, so the general user cannot change the password, unless the administrator is requested.

Tools/Materials
    • Windows
    • Mysql
Method 1 using the Set password command
    1. 1

      1, open the terminal win+r input cmd enter can open;

      2, by Mysql-u user name-p to specify the root user login to MySQL, enter after entering will prompt for password.

      3, modify the root user password of MySQL, format:mysql> set password for username @localhost = password (' new password '); Example:mysql> set password for [email protected] = password (' Shapolang '); The above example changes the user root password to Shapolang;

      Re-login, enter the new password Shapolang is OK;

      END
Method 2 with Mysqladmin
    1. 1

      1, open the terminal win+r input cmd enter can open;

      2. Change the root user password format of MySQL: mysqladmin-u user name----old password Password New password example: Mysqladmin-uroot-pshapolang password 123456

      The above example changes the user root original password Shapolang to the new password 123456

      Re-login, enter the new password 123456 is OK;

      END
Method 3 Edit the user table directly with update
    1. 1

      1, first login MySQL.

      2, Connection rights database: use MySQL;. 3. Change Password: Update user set Password=password ("Shapolang") where user= "root"; (don't forget the last semicolon). 4, Refresh permissions (must step): Flush privileges;

      Re-login, enter the new password Shapolang is OK;

      END
Method 4 When you forget the root password
    1. 1. Close the running MySQL service.

      2. Open the DOS window and go to the Mysql\bin directory. 3, enter Mysqld--skip-grant-tables return. --skip-grant-tables means skipping permission table authentication when starting the MySQL service. 4, then open a DOS window (because the DOS window has been unable to move), input MySQL Enter, if successful, will appear MySQL prompt >. 6, Connection rights database: use MySQL;. 7. Change Password: Update user set Password=password ("root") where user= "root"; (don't forget the last semicolon). 8, refresh permissions (must step): Flush privileges;. 9, quit quit.

      Restart the MySQL service, using the username root and the new password you just set the root login is OK;

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