Friday, November 04, 2011

Restore MySQL Database via Command Line

This is mostly a note to myself. It is not really a tip.

Restoring a mysql database from the command line.

[root@server]# ls -la
total 326940
drwx------ 3 user1 usergrp 4096 Oct 29 12:10 .
drwxr-xr-x 3 root root 4096 Nov 4 05:22 ..
-rw-r--r-- 1 user1 usergrp 1239136 Oct 29 12:10 mysql_db.sql

[root@server]# pwd
/backups/db/backup
[root@server]# mysql --user=mysql_user --password=somepasswd mysql_backup < mysql_db.sql