Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

phpMyAdmin problem

copy an existing sql database



7:43 am on Apr 15, 2003 (gmt 0)

10+ Year Member

How do I copy an existing sql database on an apache server with phpMyAdmin?
DB1= existing database
DB2= new database where I need the same data as DB1
I have root access.



7:56 am on Apr 15, 2003 (gmt 0)

10+ Year Member

Use the 'Export' to SQL feature, export the structure (and data if wanted), create the new DB, import.

Easy :)



9:00 am on Apr 15, 2003 (gmt 0)

10+ Year Member

How do you import the whole db?
do I have to convert it to a txt file or can I leave it as a sql file?



2:34 pm on Apr 15, 2003 (gmt 0)

10+ Year Member

I would suggest two things:

1. .sql files *are* text files. Export to .sql file from your DB1 and open it with NotePad or a text editor, and try to understand what's going on inside. Check out different .sql files that are created as a result of choosing different options. I had a real "a ha" moment the first time I did that.

2. create a duplicate temp database for playing and testing, exporting from DB1 and importing to DB1_test on the same machine, for example. Make sure you play with and understand the options, like "add 'drop table.'" Change some data in the tables, and upload again--understand how some data can be overwritten and some can't.


3:52 pm on Apr 17, 2003 (gmt 0)

10+ Year Member

I know it sounds stupid but it's just not working properly. I managed to export and then import the structure, but I can't import the data, I have no idea why. I exported the data to a .sql file but it's not importing. It's probably just something silly that I'm missing.
How can I do it with comand line in SSH?


4:06 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member


down the page it talks about "SELECT ... INTO OUTFILE" that is what you need to get the info out and then you can use load data infile to bring it back in.

If that doesn't work then you could write a script to get the data and write it to a file and then get a script to insert it as well.


Featured Threads

Hot Threads This Week

Hot Threads This Month