MySQL Root password modification

Source: Internet
Author: User

First, in the case of a known ROOT user password for the MYSQL database , the method for changing the password:

1,   shell environment, using mysqladmin command settings: mysqladmin   u root  p password  "     enter old password after return

2,   MYSQL> environment , use command, directly update mysql library user

U pdate Mysql.user Set Password=password (' new password ') where user= ' Root ' ;

Flush privileges;

Note: TheMySQL statement ends with a semicolon ";"

3. in the mysql> Environment, use the grant command to modify the root user's authorization permissions.

' localhost   identified  by   " New password " ;

Second, If you forgot the password of the ROOT user of the MySQL database , how do you do it? Here's how:

1. Close the currently running mysqld Service Program:servicemysqld stop(to first mysqld Add as System service)

2. Use the mysqld_saft script to start the MYSQLD service in Safe mode (without loading the authorization table)

/usr/local/mysql/bin/mysqld_saft--skip-grant-table &

3. Log in to the database with a root user with a blank password and reset the root user's password

mysql  -u   root

M ysql>  pdate  mysql.user  set  password=password ( ' new password '   where  user= root

M ysql> flush Privileges;


This article from "Xu Willow Blog" blog, declined reproduced!

MySQL Root password modification

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.