Jump to content

export/import with attachments in DB


ober

Recommended Posts

I'm moving a vbulletin board from one server to another and then converting it to SMF.  I got the export on the old server to finally work and I've tried to import it on the new server, but it keeps bombing out. 

Apparently vbulletin stores it's attachments in the database, instead of in a folder elsewhere.  And as soon as the database gets to the point of importing the attachments, it errors out.

And as I'm sitting here writing this, I'm wondering if it's my export type.  Currently, it's all exported to a text/SQL format.  Do I need to be exporting it as something else since it's obviously storing binary images in there?
Link to comment
Share on other sites

If you have shell access or can access "mysqldump" and "mysql" with php's executions functions then you should be able to dump and restore the database using those apps.

[code]
<?php
$dump = "mysqldump --host='...' --user='user' --password='pass' databasename --opt > /path/to/file.sql";
$import = "mysql --host='..' --user='..' --password='..' dbname < /path/to/file.sql";
?>
[/code]

Although you may be able to dump and import from the current host I'd upload the sql file and import from the new host.

You can gzip the sql file to make it smaller if the dabatase is large.
[code]
mysqldump .... --opt | gzip -c > /path/to/file.sql.gz
[/code]

and then on the new host
[code]
gzip -d /path/to/file.sql.gz
mysql .... dbname < /path/to/file.sql
[/code]

You may be able to use PhpMyadmin's sql file to do the import in which case you can skip the dumping using mysqldump.

If this is a shared host other users may be able to see the username and password that you enter on the command line above so you may want to give a temporary user full access to the database.

If you have shell access you should be able to put the username and pass in a ".my.cnf" file in your home dir to avoid that.
[code]
[client]
user=...
password=...
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.