First you kill the running mysql server gracefully. The process id is grabbed from /var/run/mysqld/ and inserted into the kill statement. Note there are ticks around the process id, not single quotes.
Then the server is restarted with the permissions turned off, and the root user password can be changed.
Type this in terminal:
sudo su
kill `cat /var/run/mysqld/mysqld.pid`
mysqld --skip-grant-tables &
mysql -u root
UPDATE mysql.user SET Password=PASSWORD ('newpassword') WHERE User = 'root';
exit
kill `cat /var/run/mysqld/mysqld.pid`
mysqld &
mysql -u root -p
Enter your new password and you should be in.
Posted by Pat McKay 


