PDA

View Full Version : sql sourcing question


dew1960
08-12-2012, 12:44 AM
Hello, I had recently backed up my server's mysql database with a dump to 'one big file'. When I just re-compiled my server. I wanted to load the old sql dump into a fresh newly created database but I get nothing but errors stating that the table doesn't exist.

I was using this command: source peq081012.sql

Should there be some kind of switch to add after the file name to tell mysql to create the tables in the big sql file backup as it sources them or would I have to source blank tables for each table in the database and then source my backed up dump file?

Perhaps I should have specified that when I did the back up as part of the dump instructions?

Is there anyway to recover my lost data? I had made some cool custom vendors which I can redo but I would rather save the time if I can. Also I had a couple characters leveled up a bit with bots already made.

If you can advise me how to restore the dump file to a new database, I would appreciate it. Thanks.

lerxst2112
08-12-2012, 12:51 AM
Explain exactly what you did when you made the backup. Did you use mysqldump?

dew1960
08-12-2012, 01:16 AM
No, I used Heidi SQL, clicked my database and selected "export database as sql"
It prompted me for a location which I chose and gave it the file name 081012.sql which was the date I made the export. The drop down box gave me the choice of "one big file", "Directory", "clipboard", and "database". I chose one big file and clicked the export button. I see now that there were check boxes for database and tables ea to select drop or create but I did not check them at the time.

I am thinking I am screwed now, LOL so I re-compiled and created a brand new server folder and re sourced the database, load_player, and Load_bots, then the updates.

I had most of my old database still on the second server I made on my laptop which I exported as a directory this time (one sql file for ea table). I am thinking I can try to run them as "load sqlfiles" to maybe update that way. I didn't have the characters on that database but I did have my custom merchants on it.

lerxst2112
08-12-2012, 03:23 AM
Yes, you are probably pretty screwed since it sounds like your dump doesn't include the necessary create statements.

If you sourced a version of the peq database that matches the schema of your dump you could truncate each table (perhaps heidi lets you select them all at once for this) and then source your dump into the empty but created tables.

mysqldump will create a file that includes the necessary drop/create statements to recreate the exact same database. The same options probably exist in Heidi as you saw a little too late, but I'm not familiar enough with it to know for sure.