Reset mysql password

For Linux servers, following are the complete steps with commands:

[1] Stop MySQL service:

# /etc/init.d/mysql stop

[2] Start MySQL with –skip-grant-tables:

# mysqld_safe --skip-grant-tables &

[3] Connect to MySQL server:

mysql -u root

[4] Set new MySQL root user password:

mysql> use mysql;
mysql> update user set password=PASSWORD("MyNewPass") where User='root';
mysql> flush privileges;
mysql> quit

[5] Stop and start MySQL service:

# /etc/init.d/mysql stop
# /etc/init.d/mysql start