sudo service mysqld stop sudo mysqld_safe --skip-grant-tables & mysql -u root mysql
Then you'll be on the MySQL prompt where you should define the new password:
UPDATE user SET password=PASSWORD("abcd") WHERE user="root"; FLUSH PRIVILEGES; exit
After this you should have dropped to the Linux console again, where you need to restart the service to enable the grant tables again:
sudo killall mysqld_safe ps ax | grep mysqld # Is it gone? sudo service mysqld start mysql -u root -p mysql
Notes
Tested on:- Gentoo Linux
- Red Hat Enterprise Linux 5/6/7