Restore To A Datasbase With A Different Name

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Ideas Centre
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Restore To A Datasbase With A Different Name

Post by ClassicMan »

Hello,

I have moved to a new host and have successfully installed phpBB3.1.9.

I need to move my forums from the old host where I could only use phpBB3.0.14. I have made regular backups from there. My database is small and can be managed through phpMyAdmin.

The new database with my new host has a different name to my previous and I'm unable to change that. Is it possible to restore one of my previous backups to a new database with a different name.

If this is possible, could someone please give a step-by-step on how to do this?

I'd be grateful for any advice.

Thanks.
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

Import the old database at your new host and change the database details to reflect this in your config.php file of the new 3.1.9 install on your new host. Make sure it points to this newly imported database. Afterwards, delete all files from the cache folder on your server except for .htaccess and index.htm.

Now your 3.1.9 install will run on your 3.0.14 database. So you still need to update that.

Re-upload the install folder from the 3.1.9 fresh set of files, and in your browser navigate to install/database_update.php. Afterwards, delete the install folder and you're done. :)
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

JimA wrote:Import the old database at your new host and change the database details to reflect this in your config.php file of the new 3.1.9 install on your new host.
Hello Jim,

Thank you for your reply.

How do I import the old database to my new host? do I use my cpanel or phpMyAdmin .. I can't see any way to import my old database. I only have the backup files. I've spent ages trying to find how to do it.

I see 'Import' in phpMyAdmin but I can't see how to import the old database.

With apologies.
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

You do need to make a database back-up first on your old host, you can use phpMyAdmin for that too.

Read the relevant parts of this article: Knowledge Base - Transferring Your Board to a New Host or Domain
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

JimA wrote:You do need to make a database back-up first on your old host, you can use phpMyAdmin for that too.

Read the relevant parts of this article: Knowledge Base - Transferring Your Board to a New Host or Domain
Hello Jim,

I do have a backup of my database and I did use phpMyAdmin Export to make the backup.

When I try to import this backup into my new 3.1.9 install I get an error 1044 and a message about creating a database if not exists.
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

Into your phpBB install? So you did use phpMyAdmin to import the database successfully?

An 1044 error indicates that it can't connect, so it's likely that the information in your config.php file is wrong. Change it and empty the cache folder on your server, except for the .htaccess and index.htm files.

If that does not work, please show us a screenshot of what error message exactly you're getting.
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

JimA wrote:Into your phpBB install? So you did use phpMyAdmin to import the database successfully?

An 1044 error indicates that it can't connect, so it's likely that the information in your config.php file is wrong. Change it and empty the cache folder on your server, except for the .htaccess and index.htm files.

If that does not work, please show us a screenshot of what error message exactly you're getting.
Hello Jim,

I don't think I have imported the old database properly .. I don't know how to do this. I only have the backup files now. I don't have access to the original phpBB3 directory as I've changed hosts.

I did try putting the old database info into the config.php file and cleared the cache but still the same error. Here's a screenshot.

Image
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

Ah, right. This might be because you're already inside of a database, likely with another name.

Try opening your .sql file and remove the "CREATE DATABASE" line in there.
That way it should only create the tables inside of the database where you're already logged in.
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

JimA wrote:Ah, right. This might be because you're already inside of a database, likely with another name.

Try opening your .sql file and remove the "CREATE DATABASE" line in there.
That way it should only create the tables inside of the database where you're already logged in.
Hello Jim,

No luck. I removed the complete line then I had an error saying something about duplicate key primary or something.

I tried again and now my board won't open at all. I'll try re-installing but it does rather look like I'm not going to be able to use my backup with this new install.
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

Well, you don't need to have a new install. The recommended route is usually to just first move your current install by uploading your current files (from 3.0.14) and importing your current database at the new host's servers, and then afterwards, upgrade your 3.0.14 install to 3.1.

Can't you create an entirely new, empty database and try to import your back-up (without the CREATE DATABASE statement) into that one?
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

JimA wrote: ..... Can't you create an entirely new, empty database and try to import your back-up (without the CREATE DATABASE statement) into that one?
I'll try this. I'm trying to reinstall my board now.

In my following SQL file, do I remove only the words CREATE DATABASE IF NOT EXISTS and if not how much more needs to be removed.

@OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;--
-- Database: `michael_community`--CREATE DATABASE IF NOT EXISTS `michael_community` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;USE `michael_community`-- ---------------------------------------------------------- Table structure for table
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

Okay, so important for this is to first have an empty database, otherwise it will not work.

REMOVE this from the .sql file:

Code: Select all

--
-- Database: `michael_community`
--
CREATE DATABASE IF NOT EXISTS `michael_community` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

USE `michael_community`
Then, replace it with the following:

Code: Select all

USE your_new_database_name;
Replace the your_new_database_name with your database name of the new database.
Save the .sql file and try to import it in phpMyAdmin again.
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

Hello Jim,

Well, we have progress. :)

I created a new blank database and was able to import my backup of the old database and it reported success.

However, when I tried to login to my board I got the following error message.

[Quote]
SQL ERROR [ mysql4 ]

Table 'friendso_community.phpbb_ext' doesn't exist [1146]

An sql error occurred while fetching this page. Please contact an administrator if this problem persists.
[Unquote]

What would cause this?
User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7754
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Restore To A Datasbase With A Different Name

Post by JimA »

So now you have the 3.0.14 database connected to your 3.1.9 forum?
If so, upload the install folder from 3.1.9 again and navigate to install/database_update.php. :)
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.
ClassicMan
Registered User
Posts: 90
Joined: Tue May 24, 2016 7:19 am

Re: Restore To A Datasbase With A Different Name

Post by ClassicMan »

Hello Jim,

Success!!!!

Everything is working great now .. phpBB3.1.9 installed with my latest 3.0.14 backup file. :D

I was beginning to think it wouldn't happen but it's all there.

Next thing I'm going to do is make a detailed how-to for all this should I need to do this again. ;)

Thank you so much for your time and patience; it really is appreciated. Is there anywhere I can give you a star or 'like' or something?

Best wishes,

Michael
Locked

Return to “[3.1.x] Support Forum”