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