Thursday, April 7, 2011

How to recover / change the root password on RedHat Linux based systems

When you lost your root password in a RedHat Linux Based systems you should first have access to the console, (the machine itself).
Power on, or reboot as needed.
and as soon as you get this screen (or similar depending your system and configurations)
screenshot 0
Now you should press 'e' and you will get this screen.
Screenshot 1
Select the image you would like to boot, and press 'e' again, and as soon as you get the nex screen
Screenshot 2
Insert an space and the number one '1' as shown in the image.
After that press ENTER and 'b' and ENTER again.


Screenshot 3Your will now have your System booted as a single user and you will have no need to enter a password.
Now you can change the password like this
#passwd
#reboot
And you will have againg your system working.
Here you can see the las two images, showing this.

ScreenShot 4ScreenShot 4

Wednesday, April 6, 2011

How to reset Mysql password

service mysqld stop or /etc/init.d/mysqld stop

wait until MySQL shuts down. Then run

mysqld_safe --skip-grant-tables &

then you will be able to login as root with no password.

mysql -uroot mysql

In MySQL command line prompt issue the following command:

UPDATE user SET password=PASSWORD("abcd") WHERE user="root";
FLUSH PRIVILEGES;
EXIT

/etc/init.d/mysqld restart