28 September 2013

How To: Backup a MySQL Database with mysqldump

Backup

The basic syntax of the command is:

# mysqldump -u username -p database_to_backup > backup_name.sql

Restore

To restore a database dump created with mysqldump, you simply have to redirect the file into MySQL again.

We need to create a blank database to house the imported data.
First, log into MySQL by typing:

# mysql -u username -p

Create a new database which will hold all of the data from the data dump and then exit out of the MySQL prompt:

# CREATE DATABASE database_name;
# exit

Next, we can redirect the dump file into our newly created database by issuing the following command:

# mysql -u username -p database_name < backup_name.sql

Your information should now be restored to the database you've created.

How To: Update Hardware Clock - CentOS 6

Change the date with the "date" command, for example:

# date --set="6 SEP 2013 15:55:00"

To update the hardware clock use the following command:

# hwclock --systohc

To view the date/time in hardware clock use the following command:

# hwclock --show