views:

109

answers:

4

I use a Wordpress plugin called 'Shopp'. It stores product images in the database rather than the filesystem as standard, I didn't think anything of this until now.

I have to move server, and so I made a backup, but restoring the backup is proving a horrible task. I need to restore one table called wp_shopp_assets which is 18MB.

Any advice is hugely appreciated.

Thanks, Henry.

A: 

What I do is open the file in a code editor, copy and paste into a SQL window within phpmyadmin. Sounds silly, but I swear by it via large files.

duckbox
This is a terrible way to do it, even tho its only 18MB, i really do not recommend this method. more than likly 18MB will crash teh broser for starters!
RobertPitt
This is likely to corrupt your data and/or not work. MySQL dump files are not text files and most editors will destroy them on a load/save. PHPMyAdmin is also terrible, and should not be used for important operations like backup/restore.
MarkR
Before reading the other comments I did try this method and it just absolutely failed.I have never used any other tools except phpMyAdmin but I am keen to give some a try. Ideally ones which are compatible with OSX.
Henryz
+2  A: 

For large operations like this it is better to go to command line. phpMyAdmin gets tricky when lots of data is involved because there are all sorts of timeouts in PHP that can trip it up.

If you can SSH into both servers, then you can do a sequence like the following:

  1. Log in to server1 (your current server) and dump the table to a file using "mysqldump" --- mysqldump --add-drop-table -uSQLUSER -pPASSWORD -h SQLSERVERDOMAIN DBNAME TABLENAME > BACKUPFILE

  2. Do a secure copy of that file from server1 to server2 using "scp" --- scp BACKUPFILE USER@SERVER2DOMAIN:FOLDERNAME

  3. Log out of server 1

  4. Log into server 2 (your new server) and import that file into the new DB using "mysql" --- mysql -uSQLUSER -pPASSWORD DBNAME < BACKUPFILE

You will need to replace the UPPERCASE text with your own info. Just ask in the comments if you don't know where to find any of these.

It is worthwhile getting to know some of these command line tricks if you will be doing this sort of admin from time to time.

Greg
Hey Greg, thanks for taking the time to help me out. Would I have the ability to connect through SSH as standard with my web hosting?
Henryz
Hi Henry, It depends. Some shared servers don't allow this, but some do. In one case I had to enable the SSH option in the admin panel for my hosted service. Who are you on, and what service are you using? You can probably use your web hosts knowledgebase or submit a support ticket to find out.
Greg
+2  A: 

try HeidiSQL http://www.heidisql.com/

  1. connect to your server and choose the database
  2. go to menu "import > Load sql file" or simply paste the sql file into the sql tab
  3. execute sql (F9)

HeidiSQL is an easy-to-use interface and a "working-horse" for web-developers using the popular MySQL-Database. It allows you to manage and browse your databases and tables from an intuitive Windows® interface.

EDIT: Just to clarify. This is a desktop application, you will connect to your database server remotely. You won't be limited to php script max runtime, or upload size limit.

arthurprs
The maximum upload for a file is 2MB, this is the problem.
Henryz
Why? I'm confused. In HeidiSQL, you don't have to worry about the backup size
arthurprs
I see, this is not web based. I am trying it now and seems like it would work. But it is giving me this error: SQL Error (1046): No database selected.I know this isn't due to the program itself but do you know why that may be happening?Thanks.
Henryz
Scratch that, I realised I had to double click the database I wanted to import to.I really like this program, I will let you know how it goes.
Henryz
How have I survived without HeidiSQL until now? Thank you @arthurprs!
TheDeadMedic
+1  A: 

use bigdupm.

create a folder on your server witch is not easy to guess like "BigDump_D09ssS" or w.e

Download the http://www.ozerov.de/bigdump.php importer file and add them to that directory after reading the instructions and filling out your config information.

FTP The .SQL File to that folder along side the bigdump script and go to your browser and navigate to that folder.

Selecting the file you uploaded will start importing the SQL is split chunks and would be a much faster method!

Or if this is an issue i reccomend the other comment about SSH And mysql -u -p -n -f method!

RobertPitt