Password forgotten after MySQL password reset

Source: Internet
Author: User

Prior to installing the XAMPP in CentOS, set the MySQL database root password, today need to add a database, found to forget what the password was set before. After some of the struggle, finally understand, note that the following operations are operating as the root of Linux, the other is not tested, visual inspection as long as the permission should be no problem.

Stop MySQL First
/opt/lampp/lampp stopmysql 我用的 sudo /opt/lampp/lampp stop

And then it starts mysqld.
/opt/lampp/sbin/mysqld --skip-grant-tables &

You'll see output like this.

2014-04-29 10:54:43 25686 [Note]/opt/lampp/sbin/mysqld:ready for connections.
Version: ' 5.6.16 ' socket: '/opt/lampp/var/mysql/mysql.sock ' port:3306 Source distribution on

At this point the cursor may stop on and not go back to the prompt, then hit enter and then go back to the command prompt.
Next, you can log in to the MySQL database with a null password root
/opt/lampp/bin/mysql -u root

Set it to the new root password.

mysql> use MySQL;
mysql> Update user Set Password=password ("123456″) where user= ' root ';
mysql> flush Privileges;
Mysql> quit

Restart MySQL
/opt/lampp/lampp stopmysql
/opt/lampp/lampp startmysql

Password forgotten after MySQL password reset

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.