What should I do if I forget the mysql database root password? _ MySQL

Source: Internet
Author: User
What should I do if I forget the mysql database root password? bitsCN.com

1. log on to the system as the root user and enter the terminal

[Root @ localhost/] #

II. killing the mysql process

Method 1: [root @ localhost/] # killall mysqld

Method 2: [root @ localhost/] # ps-aux // view all processes and find the mysql process pid

Then

[Root @ localhost/] # kill pid // pid indicates the mysql process ID

3. use the -- skip-grant-tables parameter to start mysqld

[Root @ localhost/] #/usr/local/mysql/bin/mysqld_safe -- skip-grant-tables &

// Where/usr.../bin is my mysql installation directory

[Root @ localhost/] #/usr/local/mysql/bin/mysql // enter mysql

Mysql> use mysql // switch to mysql database

Mysql> UPDATE user SET password = password ('000000') WHERE user = 'root ';

// Set the root password to 123456.

BitsCN.com

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.