Previously installed in Ubuntu 12.04 Xampp, set up the MySQL database root password, need to add a database today, 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
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 now. Note: This is not the case, cannot be set to clear text password, first empty it, that is, set to an empty string. Allow the root user to log in again
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
What does the MySQL password forget?