MySQL Reset root password

Source: Internet
Author: User

Recent projects used to MySQL because the computer MySQL is a long time ago installed root password forgotten, Baidu reset Password

Windows:

1. Log in as a system administrator;

2. Stop the MySQL service;

3. Go to cmd and enter the MySQL installation directory, assuming it is d:/mysql/mysql Server 5.0/;

4. Skip permission Check to start MySQL,

D:/mysql/mysql Server 5.0/bin/mysqld-nt --Skip-grant-tables

5. Reopen a cmd and go to D:/mysql/mysql Server 5.0/bin/,

Reset Root Password

D:/mysql/mysql Server 5.0/bin/mysqladmin-uroot flush-privileges password "NewPassword"

D:/mysql/mysql Server 5.0/bin/mysqladmin-u root-p shutdown

Replace NewPassword with your new password, and the second command will let you enter a new password again.

6. In cmd net start MySQL

Unix&linux:

1. Log in to the system with root or user running mysqld;

2. Use the KILL command to end the process of mysqld;

3. Start MySQL Server with the –skip-grant-tables parameter

#mysqld_safe –skip-grant-tables &

4. Then use the root user login Mysql;mysql-u root with a blank password

5. Set a new password for [email protected]

mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ' mysql> flush privileges;mysql> quit

6. Restart MySQL

Note that the place of the red callout is two "-". Do not let name execution will error "-K ..."

MySQL Reset 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.