PDA

View Full Version : Restore a Backup from .SQL file


kochier
08-01-2008, 07:42 AM
Alright I accidently erased my entire DB, wasn't really thinking, clicked the delete button then the confirmation, and I need to restore it. I've been trying to use mysqlimport but I get the error message You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqlimport -h hostname -u username -p password dbname backup.sql' at line 1

Jayy
08-01-2008, 07:54 AM
Could you post the first few lines for me or anyone to see?

kochier
08-01-2008, 08:05 AM
<?php
include 'opendb.php';
mysql_query("mysql -u username -p password database < backup.sql;") or die(mysql_error());
?>

Jayy
08-01-2008, 08:12 AM
Couldn't you just restore the database with phpmyadmin?

The script might not work if your PHP settings have safe mode on.


mysqlimport -u username -p password databasename location1/location2/filename.sql

kochier
08-01-2008, 08:20 AM
Actually a friend pointed me to BigDump, which worked out very nicely. Going to bed now before I mess anything else up.