Thursday, October 30, 2008

How to change the Time Zone on your Redhat / Centos system

cp /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime

will set your time zone to SAST

you can simply use Tab auto completion to find the exact time zone you want by choosing the continent and city of your choice for example to change your timezone to London's time

cp /usr/share/zoneinfo/Europe/London /etc/localtime

to change to universal time type

cp /usr/share/zoneinfo/Universal /etc/localtime

to change to GMT time type

cp /usr/share/zoneinfo/GMT /etc/localtime

if asked if you want to overwrite the localtime file answer yes.

Tab auto completion is very useful in finding the exact time zone you want.

Tuesday, October 14, 2008

How to backup and restore a Mysql database

To backup your mysql database type the following.

mysqldump -u username -ppassword database_name > dump.sql

make sure not to leave a space between the -p and the password, otherwise mysql will prompt you for a password and will assume that your password is the database name.

the entire database will be backed up into the dump.sql file

then to restore the database type the following

'mysql -u username -ppassword database_name < dump.sql'