[HowTo] Transfer hosts/backup and restore database

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

[HowTo] Transfer hosts/backup and restore database

Post by Black Fluffy Lion » Sat Mar 30, 2002 5:29 pm

New link to the Knowledge Base

Since lots of people seem to be asking this, I've decided to make up a handy dandy idiot's guide on moving your fora to a different host.

I backed up everything on the FTP but when I uploaded it to my new host all the information had gone! How comes?

The files on your FTP, the ones you downloaded from sourceforge do not contain the data of your fora. The data is stored in (suprise, suprise) the database. That is where all your information (post text, members, smiley information etc.) is. If you don't want to lose that information you'll have to back up the database, backing up the files will do nothing.

So how do I back up the database?

If you have admin access to the site there's a nice little feature called backup database which (suprise, suprise) backs up the database! Click on it (remember, this is the idiot's guide, sorry if it sounds obvious) and back up the database with structure and data. Compress it if you wish, but only if your new server will be able to handle a gzipped file.

That's all very well and good but I don't have admin access. How do I back it up now?

You may have a nice little program called phpMyAdmin installed. This can also backup your database. To do so click on your username at the top of the left frame. Scroll down the right frame a bit until you reach 'View dump (schema) of database'. Again, you want to backup both structure and data. When you have selected the settings you want click 'Go' and you will download the dump file of your database. Easy huh??

I can't use the admin panel database backup option and I don't have phpMyAdmin. Can I still backup?

Yes, but only if you have telnet access to your server. From the command-prompt, do the following:

>mysqldump -u USERNAME -p DATABASE_NAME >backup.sql

USERNAME is the mysql username for your database
DATABASE_NAME is the mysql database name of the phpBB database

Right, I've backed up my database. Now how do I restore all the information to my new host?

Install phpBB2 at your new host and go to the admin panel and select 'Restore database'. Find the file on your computer and upload it!

I don't have access to the admin panel! How can I restore it?

If you don't have access to the admin panel then you can do it by phpMyAdmin as well. Click your username on the top left and scroll down the right frame until you reach 'Or Location of the textfile'. Click 'browse' and find the file. Click 'Go' and watch your database being uploaded! Note: phpMyAdmin cannot always handle uploading large databases.

I can't restore it through the admin panel and don't have phpMyAdmin either. How do I restore the database?

Copy the backup.sql file to the new server location and import it with:

>mysql -u USERNAME -p DATABASE_NAME < backup.sql

USERNAME is the mysql username for your database
DATABASE_NAME is the mysql database name of the phpBB database

Is that all?

Almost...chances are your information has changed since your last host so make sure you update config.php to reflect these changes.

Now, is that all?

Yes.

hope that was very easy to understand and that this question will not arise again...

comments, complaints and questions welcome. :)
Last edited by Black Fluffy Lion on Fri Jun 28, 2002 4:51 pm, edited 5 times in total.

User avatar
Daz
Registered User
Posts: 5236
Joined: Fri Dec 07, 2001 2:39 pm
Location: Yorkshire, UK

Post by Daz » Sat Mar 30, 2002 6:23 pm

phpMyAdmin has its limitations when it comes to big(ish) databases. It wouldn't upload mine although it was only 4Mb.

You have the option of using Telnet for situations such as this, but another solution (apart from the built it phpBB function) is to split your database file into sections - you can even past it all as seperate queries in the Query window if you like.
Please and Thank You works wonders...
I reserve the right to post illogical (and totally wrong) replies.
...It's the subtle perfection in attention to detail that makes your work rock the way it does - cdkrg
Think simple - it's not necessarily what you draw that matters, it's what you perceive - Daz

Note: ForumImages<dot>com is no longer anything to do with me.

Matthijs
Former Team Member
Posts: 1031
Joined: Sat Dec 08, 2001 4:27 pm
Location: The Netherlands
Contact:

Post by Matthijs » Sat Mar 30, 2002 7:04 pm

I'll add a little something to this guide:

I can't use the admin panel database backup option and I don't have phpMyAdmin. Can I still backup and restore?

Yes, but only if you have telnet access to your server. From the command-prompt, do the following:
>mysqldump -u USERNAME -p DATABASE_NAME >backup.sql

Now copy the resulting backup.sql file to the new server location and import it again with:
>mysql -u USERNAME -p DATABASE_NAME < backup.sql

USERNAME is the mysql username for your database
DATABASE_NAME is the mysql database name of the phpBB database

Keywords for search: backup backups database mysql forum move different other host server
phpBB Converter Team Member
Developer of the vBulletin 2.x.x -> phpBB 2.0.x Converter
See Matthijs.net for more info

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Sat Mar 30, 2002 7:40 pm

thanks guys, added 8)

Cyberkiller
Registered User
Posts: 55
Joined: Thu Jan 17, 2002 9:38 pm

Post by Cyberkiller » Fri Apr 12, 2002 8:19 pm

I dl'd a backup off the db thru the phpbb admin panel. The new server won't take the restore because I believe the db is too large. How do I manually restore it back into mysql? I tried

mysql -u USERNAME -p DATABASE_NAME < backup.sql

but it didn't work and i don't really know much cmd prompt stuff for mysql.

Thanks
-Cyberkiller
http://www.anythingchat.com <- Off-Topic Discussion
http://www.webhostbidding.net <- Where webhosts bid for your hosting.
http://www.jerlabs.net <- Tech News & Reviews

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Fri Apr 12, 2002 8:25 pm

how big is it??

you could try splitting it up and then uploading it piece by piece.

webgp
Registered User
Posts: 27
Joined: Sun Feb 17, 2002 12:44 am

Some simple scripts to backup and restore database.

Post by webgp » Tue Apr 16, 2002 2:52 am

I made a modified version of two GPL softwares , Xt-dump and Uqiqi , to back and restore database using php only that can work with large Mysql databases.

Xt-dump it’s simple utility that generate an SQL file on the server , the directory where Xt-dump it’s located must have write permissions. The scripts runs in many steps of 20 seconds to avoid php time limit.

You can download Xt-Dump from http://membres.lycos.fr/webforumgp/xtdump/ .

The original Xt-dump can be found at http://dreaxteam.free.fr/

My version of Uqiqi is indeted to restore a Mysql database from the SQL file generated by Xt-Dump presented above. You upload , using a ftp software, SQL or SQL.gz file to the directory where uqiqi is located and click a button to restore the database. The scripts runs in many steps of 20 seconds to avoid php time limit. Php Zlib support must be enabled on the server.

You can download Uqiqi from http://membres.lycos.fr/webforumgp/uqiqi/.

The original Uqiqi can be found at http://membres.lycos.fr/uqiqi/
Last edited by webgp on Sat Apr 20, 2002 1:46 pm, edited 1 time in total.

User avatar
403forbidden
Registered User
Posts: 14
Joined: Fri Apr 12, 2002 2:59 pm
Location: Los Angeles

Post by 403forbidden » Tue Apr 16, 2002 10:18 am

I have a feeling that this method of transfering hosts does not work if the new host is running PHP in safe mode. Am I correct? If so, is there any workaround?

I tried the above method, but phpBB won't recognize the database that I uploaded.

Thanks
Last edited by 403forbidden on Mon Apr 22, 2002 11:15 pm, edited 1 time in total.
Image

User avatar
roly
Registered User
Posts: 775
Joined: Fri Jan 04, 2002 7:13 am
Location: Australia

Post by roly » Sat Apr 20, 2002 1:28 am

403forbidden wrote: I have a feeling that this method of transfering hosts does not work if the new host is running PHP in safe mode. Am I correct? If so, is there any workaround?

I tried the above method, but phpBB won't recognize the database that I uploaded.

Thanks

its not safe mode but most hosts that have safe mode have no file uploads.
u can copy into the phpmyadmin box

bossboy
Registered User
Posts: 1
Joined: Mon Apr 22, 2002 11:06 pm

transfering old db from hostA to hostB running the new phpbb

Post by bossboy » Mon Apr 22, 2002 11:09 pm

I have and older version of phpBB installed on a friend's server.
I can get the database(s) from him.

How would I go about installing it on the new server which is running phpBB 2.0?

Would it be the same process as stated above? Or would I need to go an extra step and somehow update it before upload?

Any help would greatly be appreciated

lukemedway
Registered User
Posts: 27
Joined: Tue Apr 02, 2002 2:40 am
Location: UK
Contact:

Post by lukemedway » Tue Apr 23, 2002 1:30 am

I succesfully backed up my database and followed all the steps, but just one problem...

(theres always one isnt there?)

When i try to restore my database, i browse the file and everything (bearing in mind that my username is the same on this board as it is on the board that should restore) uploads great and it says, you have succesfully restored your database blah blah blah... But above that i get lots of header information problems :(
Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php on line 941

Warning: fopen("/tmp/phpgD2HQo","r") - Operation not permitted in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php on line 941

Warning: Supplied argument is not a valid File-Handle resource in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php on line 941

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 162

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 163

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 164

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 165

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 166


its saying that admin_db_utilities.php is in the wrong directory? Er, what?
I need a drink there is too much blood in my alcohol stream

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Re: transfering old db from hostA to hostB running the new p

Post by Black Fluffy Lion » Tue Apr 23, 2002 3:43 pm

bossboy wrote: I have and older version of phpBB installed on a friend's server.
I can get the database(s) from him.

How would I go about installing it on the new server which is running phpBB 2.0?

Would it be the same process as stated above? Or would I need to go an extra step and somehow update it before upload?

Any help would greatly be appreciated


the ways described above should work for phpBB1 too, exept, obviously, the way through the admin panel. then, just upload the new phpBB2 and run the upgrade script. you don't need to restore the old database again since you shouldn't have lost any information, just do the backup beforehand in case something goes wrong.


I succesfully backed up my database and followed all the steps, but just one problem...

(theres always one isnt there?)

When i try to restore my database, i browse the file and everything (bearing in mind that my username is the same on this board as it is on the board that should restore) uploads great and it says, you have succesfully restored your database blah blah blah... But above that i get lots of header information problems

Quote:
Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php on line 941

Warning: fopen("/tmp/phpgD2HQo","r") - Operation not permitted in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php on line 941

Warning: Supplied argument is not a valid File-Handle resource in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php on line 941

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 162

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 163

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 164

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 165

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/admin_db_utilities.php:941) in /usr/local/psa/home/vhosts/devjunkie.co.uk/web_users/djclan/phpBB2/admin/page_header_admin.php on line 166


its saying that admin_db_utilities.php is in the wrong directory? Er, what?


and this problem only occurs after you restore and old database??

check that there is onnly 19 lines in config.php

lukemedway
Registered User
Posts: 27
Joined: Tue Apr 02, 2002 2:40 am
Location: UK
Contact:

Post by lukemedway » Tue Apr 23, 2002 4:10 pm

Yer i have checked the config.php file and it is 19 lines exactly!

Someone said that it could be that my host is running in safe-mode and that is probably why its trhowing up an error!
I need a drink there is too much blood in my alcohol stream

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Tue Apr 23, 2002 4:17 pm

hmmm...have you tried reuploading the file, in ACSII format??

lukemedway
Registered User
Posts: 27
Joined: Tue Apr 02, 2002 2:40 am
Location: UK
Contact:

Post by lukemedway » Tue Apr 23, 2002 4:25 pm

ASCII format, no i set it to auto on the ftp, so it should have done it anyway!
I need a drink there is too much blood in my alcohol stream

Locked

Return to “2.0.x Support Forum”