Reseting a lost password with MYSQL

if you forget the root password for MYSQL, and you need to access it to edit database, follow the steps below.

# /etc/init.d/mysqld stop 
# killall mysqld 
# mysqld --skip-grant-tables --user=root & 
# mysql mysql> use mysql;
mysql> update user set password=password("newpass") where user = "root";
mysql> flush privileges;
mysql> exit;
# killall mysqld 
# /etc/init.d/mysqld start

Continue reading