Page 1 of 1

Restoring MySQL dump files

Posted: Thu Dec 04, 2008 1:37 am
by cah
I created a backup script to backup MySQL DB schemas some time ago.

I was playing with phpBB3 and accidentally deleted a post.
I then tried to get the post back, of course.

Fortunately, I have MySQL schemas backed up daily.
I found last night(this morning)'s backup and just needed to restore it.

Here is the command I issued:

Code: Select all

Syntax:

<PATH>/mysql -u<USER> -p <DB Name> < <SQL dump file>

Code: Select all

/usr/local/bin/mysql -udbuser -p phpBB3 < ./phpBB3-backup-20081203053506.sql
NOTICE wrote:
  1. DB user (dbuser) comes directly after "-u", no space in between.
  2. -p means the command will ask for user's password from command line.
  3. phpBB3 is the database (schema).
  4. MySQL dump file (phpBB3-backup-20081203053506.sql) is read into MySQL and all files are put into right place.