- stop mysql server
- run mysql server safe mode with option –skip-grant-tables
- login to your mysql server using user root
- change the root password
- restart mysql server
$ /etc/init.d/mysql stop
if it doesn’t work then kill the process
$ ps aux | grep mysql
now you got the mysql pid, then kill it
$ kill -9 <pid>
$ /usr/bin/safe_mysqld --skip-grant-tables
$ /usr/bin/mysql -u root
mysql> UPDATE user SET Password=PASSWORD('YOUR_PASSWORD') WHERE Host='localhost' AND User='root';
$ /etc/init.d/mysql restart
Advertisement