Add a password to the root user after MySQL installation is complete

Source: Internet
Author: User
  1. Edit the configuration file for MySQL: My.ini (under MySQL installation directory).

    Open the configuration file, add: Skip-grant-tables on the last line of the file, and then save the exit.

    This means that the grant-tables does not start when you restart MySQL.

  2. To restart the MySQL service:

    net stop MySQL

    net start MySQL

  3. 3

    Set the new root password.

    Mysql-u root-p Direct Enter, no need to enter the password to enter the database.

    Use MySQL at the command line (switch to system database)

    Execute the following statement to modify the root user password:

    Update user set Password=password ("123456") where user= ' root ';

    Note that the new version of the password field is changed, and the field is named "Authentication_string", so you need to execute the script below.

    Update user set Authentication_string=password ("123456") where user= ' root ';

  4. 4

    Restore the configuration file and delete the row you just added in the configuration file. Then restart the MySQL service and you will be able to log in with the newly set password.

Add a password to the root user after MySQL installation is complete

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.