Web Hosting Talk







View Full Version : Trying to load a backup SQL file into the table


BlakIce
03-22-2005, 09:26 PM
I have a mambo site that crashed today and Servint was very helpfull in rolling back my vps to correct the problem but the roll back was before some signups (about 300) so i downloaded a backup of the user table in phpmyadmin and now that everything is fixed I want to import the sql file into the table when i try i just get blank lines where the data is so I was looking at the import tools and found out I was missing info so I wanted to know if you guys could tell me the correct parameters.

Here is a line from the backed up file...

INSERT INTO `mos_users` VALUES (66, 'Test', 'Test', 'DavidM06@Gmail.com', 'b25c62201b920679722a7f1086fcd9f4', '', 0, 0, 18, '2005-01-26 15:01:46', '2005-02-03 12:31:43', '', '');

What i need to know is, what are the

Fields terminated by
Fields enclosed by
Fields escaped by
Lines terminated by

any suggestion would be helpfull

DediPlace
03-22-2005, 09:41 PM
What import tool are you using. You are in a vps, you can import the .sql file in ssh with the command mysql user_databasename < file.sql or mysql databasename < file.sql

BlakIce
03-22-2005, 09:43 PM
i am using the import feature in phpmyadmin, I am not that well versed in SSH yet

error404
03-23-2005, 02:56 AM
What you've got is a dump of SQL commands that can be directly executed to recreate the database, not a simple data file as you're trying to import. What you need to do is go to the SQL tab in phpMyAdmin, and browse for your backup file there, then execute it.

This can be flaky, however, due to PHP max_exec_time and the like. The best solution is to log in to the shell and execute 'mysql -u user -p database < filename.sql'. If you don't have the option to do that, your best bet may be contacting your host, they should have no problems doing this for you at no charge.

BlakIce
03-23-2005, 03:09 AM
Thanks for the suggestion, when I do it that way it tells me the table already exists. I am trying to merge files together, the saturday backup with the monday backup. My Noc is looking into they are having the same problem I am with it saying the table already exists, but tehy were going to dig deeper and see what they find

error404
03-23-2005, 05:40 AM
You'll then need to modify the file itself and remove the CREATE TABLE lines if the tables already exist. Beware, however, that any rows in the backup and the running database will either a) cause errors (duplicate keys), or b) be duplicated in the resulting database.