cleary1981 Posted December 5, 2012 Share Posted December 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/271642-duplicate-mysql-db-not-backup-and-restore/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 5, 2012 Share Posted December 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/271642-duplicate-mysql-db-not-backup-and-restore/#findComment-1397716 Share on other sites More sharing options...
Psycho Posted December 5, 2012 Share Posted December 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/271642-duplicate-mysql-db-not-backup-and-restore/#findComment-1397719 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.