How to retrieve the mysql password with -- skip-grant-tables

Source: Internet
Author: User
This article introduces a method to retrieve the password of mysql. We use -- skip-grant-tables to retrieve the password of a forgotten mysql. If you need it, please refer to this article.

This article introduces a method to retrieve the password of mysql. We use -- skip-grant-tables to retrieve the password of a forgotten mysql. If you need it, please refer to this article.

MySQL password change method Daquan:

The Code is as follows:

Mysql> update user set Password = password ('newpassword') where User = 'root'; mysql> flush privileges; MYSQLADMIN-u root-p PASSWORD mypasswd can be used to modify MY In the MYSQL folder. INI File


Mysql> set password for myuser @ localhost = PASSWORD ('mypasswd'); mysql> grant usage on *. * TO myuser @ localhost identified by 'mypassword ';


The above content is an introduction to the MySQL password forgot solution. I hope you will get some benefits.


Operation Method of skip-grant-tables:

1. Kill the original mysql:

The Code is as follows:
Rcmysqld stop
Or:
Service mysqld stop
Or:
Kill-TERM mysqld

2. Start mysql with command line parameters:

The Code is as follows:
/Usr/bin/mysqld_safe -- skip-grant-tables &

3. Modify the administrator password:

The Code is as follows:
Use mysql;
Update user set password = password ('yournewpasswordhere ') where user = 'root ';
Flush privileges;
Exit;

4. Killing mysql and restarting mysql

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.