Correct Solution for MySQL to forget the root password

Source: Internet
Author: User
Tags mysql tutorial

Correct Solution for forgetting the root password in the mysql tutorial

This article describes the correct solution for mysql to forget the root password. We all know that the password is missing during actual operations.

This is a headache. The following are the correct solutions for this problem.

In the future, there will be no small gains.

Mysql root Password forgot solution:

In windows:

Open the command line window and stop mysql service: net stop mysql

Start mysql, usually to the installation path of mysql, find the mysqld-nt.exe

To this directory:

C: program filesmysqlmysql server 5.0bin>

Run: mysqld-nt -- skip-grant-tables

Open a command line window and execute mysql

> Use mysql # select a database tutorial

1.> update user set passwordpassword = password ("new_pass") where

User = "root ";

2.> flush privileges;

3.> exit

Use ctrl + alt + del to find the mysqld-nt process and kill it. Restart the mysql-nt Service.

Log on with a new password

Solution for mysql to forget the root password: in linux:

If mysql is running, killall-term mysqld is first killed.

Start mysql: bin/safe_mysqld -- skip-grant-tables &

You can access mysql without a password.

Then

1.> use mysql

2.> update user set passwordpassword = password ("new_pass") where

User = "root ";

3.> flush privileges;

Kill mysql again and start mysql in a normal way.

If mysql is running, killall-term mysqld is first killed.

Start mysql: bin/safe_mysqld -- skip-grant-tables & (sometimes yes

Mysqld_safe)

You can access mysql without a password.

Then/usr/local/mysql/bin/mysql

1.> use mysql

2.> update user set passwordpassword = password ("new_pass") where

User = "root ";

3.> flush privileges;

Kill mysql again and start mysql in a normal way.

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.