FanaticZine

Restore MySQL Database Backup using command line

by z7oofy on Jul.13, 2009, under MySQL

If you are trying to restore a large database backup back to  your MySQL Server, You know that phpMyAdmin is NOT the best solution for the task, beacause of it’s execution limitaion settings it will reject your file being executed. So one way to archive this is to use the mysql command prompt interface. the syntaxt to back up your database unsing command links is.

mysql -u {UserName} -p {TargetDatabase} < {SourceDumpFile}

{UserName} = Your Database username

{TargetDatabase}= Your Target Databse

{SourceDumpFile}=  Your  SQL Dump File

once you run the above line correctly. you should be prompt for a password, Enter your database password and continue. (the restoring time  depends on the size of your database, so be patient and a grab a coffee if it’s so large.)

:, , , ,

1 Comment for this entry

  • Dush

    If youR SQL dump file has a CREATE DATABASE command, you can try following as well.

    mysql -u {USERNAME} -p < {FILENAME}.sql

    this will create the database on the fly.. :)

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

  • Dedicated for entertainment