Monday, September 22, 2008

Reset Linux Password

Please note that you cannot perform this remotely, you must be physically at the machine!!!

1. the first step is to reboot server.
2. Since the server i inherit has GRUB, wait until the grub splash screen comes on and hit the letter 'e' on your keyboard. this will stop grub.









3. hit 'e' again and this will take you to another screen
4. you should see one of the choices has "kernel" select the one with "kernel
5. hit 'e' on your keyboard
6. type ' single' (make sure to include a space before "single") and hit enter. then enter 'b' to boot.
7. your system should boot up in single mode as root
8. now that you are logged in single mode you can chage the root password by sending this command:
Code: passwd

9. after you have changed the root password, reboot server and you should be able to login with the new password.

DONE

LILO ----------------------------
1. If you have LILO, its different, fist reboot server and when you see the LILO: prompt type "linux single" and hit enter. this will log you in as root in single user mode.
2. Once booting is complete, you can change your password with this command:
Code:

passwd

and reboot server.

DONE

Running more than one mysql on same systen

1. Extract mysql code. 
2. Create folder for containing all files for new mysql server 
   folder path= /home/mysql_instances/slaves/slave3320/mysql/
3. ./configure --prefix=/home/mysql_instances/slaves/slave3320/mysql/ --with-federated-storage-engine
4. Make
5. Make install
6. Go to /home/mysql_instances/slaves/slave3320/mysql/bin
7. ./mysql_install_db --basedir=/home/mysql_instances/slaves/slave3320/mysql/
8. Go to directory /home/mysql_instances/slaves/slave3320/mysql/var/
9. cp /usr/src/redhat/SOURCES/mysql-5.0.67/support-files/my-medium.cnf ./my.cnf
10. vi my.cnf
11. Set server/client port as 3320
12. set server/client socket path as /home/mysql_instances/slaves/slave3320/mysql/var/mysql.sock
13. cd /home/mysql_instances/slaves/slave3320/mysql/libexec
14. ./mysqld --defaults-extra-file=/home/mysql_instances/slaves/slave3320/mysql/var/my.cnf --skip-grant-tables -u root &
15. cd /home/mysql_instances/slaves/slave3320/mysql/bin
16. ./mysql -S /home/mysql_instances/slaves/slave3320/mysql/var/mysql.sock 
17. on the mysql prompt run following query
    update mysql.user set password=PASSWORD('') where user='root';
    flush privileges;
It will set password for root on the mysql server.
18. Kill mysqld server 
19. run mysqld server again as 
    ./mysqld --defaults-extra-file=/home/mysql_instances/slaves/slave3320/mysql/var/my.cnf -u root & All has been done, you have new instance of mysql running on defined port 3320 
20. access mysql server running on port 3320 by socket file
  /home/mysql_instances/slaves/slave3320/mysql/bin/mysql -S /home/mysql_instances/slaves/slave3320/mysql/var/mysql.sock -u root -p
enter your new password 

:-)