Resetting Mysql root password
Mysql password can be reset by
- Shutdown mysql
- Start mysql with a special option safe_mysqld --skip-grant-tables
- Login to mysql and update the user table UPDATE user SET password=null WHERE Host='localhost' AND User='root';
- Shutdown mysql
- Startup mysql normally
- Change the root password by mysqladmin -uroot password 'new-password'
Resetting mysql user password
mysql> set password = password("yournewpassword");
Another way
http://code.openark.org/blog/mysql/dangers-of-skip-grant-tables