Root password reset for MySQL

Source: Internet
Author: User

Root password reset for MySQL

To set the MySQL root password:

#mysqladmin-uroot Password ' Qiangge ' (the underlined part is the root password)

# Mysql-uroot-pqiangge

If you forget the MySQL root password, the workaround is as follows:

(1) Edit MySQL master configuration file my.cnf

#vim/etc/my.cnf

Add a parameter under the [Mysqld] field

Skip-grant

(2) Restart the database service

#service mysqld Restart

(3) So you can access the database without authorization.

#/usr/local/mysql/bin/mysql-uroot

(4) Modify the corresponding user password

> Use MySQL;

> Update user set Password=password (' Your password '(new password)) where user= ' root ';

>flush privileges;

>quit;

(5) Modify/ETC/MY.CNF remove Skip-grant, restart Mysqld service


This article from "12350027" blog, declined reprint!

Root password reset for 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.