Connecting Tech Pros Worldwide Forums | Help | Site Map

How do I move a database with binary content ?

Newbie
 
Join Date: Jun 2007
Posts: 4
#1: Jun 23 '07
I have moved to a more recent operating system. The staff of the hosting company did the move. They took an exact copy of the database and moved it.
Problem: the binary blob-fields used to store images, can no longer be read as photo-files => photos are in correct proportions, but are a no-show (rectangle - in the right proportions - with red cross on the upper left corner).

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,751
#2: Jun 23 '07

re: How do I move a database with binary content ?


Hi, and welcome to TSDN!

As far as I know, using "SELECT * INTO OUTFILE" and "LOAD DATA INFILE" should backup your data and restore it correctly.

You could try this, just to see if it works. DO NOT however try this on data you don't want to lose untill you have tested it!
Expand|Select|Wrap|Line Numbers
  1. /* Create backup */
  2. SELECT * INTO OUTFILE 'backup.txt' FROM myTbl;
  3.  
  4. /* Truncate test table */
  5. TRUNCATE myTbl;
  6.  
  7. /* Restore data */
  8. LOAD DATA INFILE 'backup.txt';
  9.  
  10.  
Newbie
 
Join Date: Jun 2007
Posts: 4
#3: Jun 23 '07

re: How do I move a database with binary content ?


Thank you for your reply, I will test this and let you know if it helped me.
Newbie
 
Join Date: Jun 2007
Posts: 4
#4: Jun 25 '07

re: How do I move a database with binary content ?


I get the error message in php that there is a "syntax error, unexpected T_STRING in /home/.../bedrijf_test.php" on line 15
SELECT * INTO OUTFILE 'backup.txt' FROM foto_copie;
Newbie
 
Join Date: Jun 2007
Posts: 4
#5: Jun 25 '07

re: How do I move a database with binary content ?


errormessage that access is denied for my username.
Is this way only preserved for the root ?
Reply