Reset the Mysql root password _mysql in the Linux system

Source: Internet
Author: User

You know, we often need to use the MySQL database in Linux or Windows, but we often make a very low-level small error, small set also often make mistakes, suddenly forget the MySQL root password, then will bring a series of trouble, The following small series tells you how to reset root password on the Linux operating system.
Method/Step
The first step is to check whether the operating system has a MySQL database installed in the Debian operating system to check the command: dpkg--list |grep MySQL as follows:


First check whether the root user password has been forgotten, enter the command: Mysql-uroot-p the following figure:

Tragedy, the database root password forgotten, reload is not a benefit, the following small white to tell you how to skip security verification Change password, first close the process of MySQL service, the following figure:


Then start the mysql,/usr/local/mysql/bin/mysqld_safe–skip-grant-tables in an abnormal way &
The following figure:


This allows you to enter Mysql,/usr/local/mysql/bin/mysql-u root-p without a password (enter the password when required), as shown below:

Then there is the >use mysql;>update user set Password=password ("Enter a new password") where user= "root"; >flush privileges; re-kill the MySQL process. Use normal method to start MySQL, all OK, finished, the following figure:

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.