MySQL forgot root password correct solution

Source: Internet
Author: User
Keywords Network programming Mysql tutorial
Tags command line kill mysql mysql tutorial net network network programming operation

mysql tutorial forget root password correct solution

Described is the mysql forget root password correct solution, we all know in the actual operation of the forgotten password

Is a very troublesome thing, the following is the correct solution to this problem is given, hope you are browsing

After the harvest will not be small.

Mysql forgot root password solution:

Under the windows:

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

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

Come to this directory:

c: program filesmysqlmysql server 5.0bin>

Execute: mysqld-nt --skip-grant-tables

In addition to open a command line window, execute mysql

> use mysql # select database tutorials

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

user = "root";

2.> flush privileges;

3.> exit

Use ctrl + alt + del, find the process mysqld-nt kill it, restart the mysql-nt service, you can

Log in with a new password

mysql forget root password solution: under linux:

If mysql is running, kill first: killall -term mysqld.

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

You can enter the mysql without a password.

Then that's it

1.> use mysql

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

user = "root";

3.> flush privileges;

Re-kill mysql, use the normal method to start mysql.

If mysql is running, kill first: killall -term mysqld.

Start mysql: bin / safe_mysqld --skip-grant-tables & (Sometimes it will be

mysqld_safe)

You can enter the mysql without a password.

Then is / usr / local / mysql / bin / mysql

1.> use mysql

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

user = "root";

3.> flush privileges;

Re-kill mysql, use the normal method to start mysql.

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.