Jump to content

Recommended Posts

Apologies if this sounds stupid, it's been a while since I have done any development.

 

I have a site hosted on 1and1 server connected to a DB. I have copied the whole site into a sub directory to make changes to the code. I want to make a new DB with all the same data as my Live site. When I export the data using phpmyadmin and import it just overwrites the existing DB.

 

Is there a way I can export my DB and then rename it so when I upload it I have two databases?

 

Thanks in advance.

In your .sql backup file, there are lines like -

 

CREATE DATABASE IF NOT EXISTS db_name;
USE db_name;

 

Just enter a new name for the db_name.

 

You will also need to assign a database user permissions to use that new database.

Aside from your question I would add the following advice:

 

Instead of copying the files into a subfolder I would advise creating a new top level directory, copy all your files there, and then create a sub-domain for your development environment, e.g. dev.mydomain.com.

 

If you have any file paths in the PHP or HTML that is relative to the root of the web root or the URL you will run into errors if just running from a sub-folder. But, then again, if your intent is to modify the site to work from sub-folders then you would want to do that.

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.