Mysqladmin change root password
tonyn | December 2, 2008First, you want to stop the mysql daemon.
# /etc/init.d/mysql stop
Second, issue a command to allow you to change the mysql root password by skipping the tables that grant permissions.
# mysqld --skip-grant-tables
Next, using mysqladmin you can now change the root password
# mysqladmin -u root password 'newpasswd'
That’s it! Now you can start the mysql daemon again.
# /etc/init.d/mysql start