Copying a database into a new database including structure and data
Posted
by
Jason
on Stack Overflow
See other posts from Stack Overflow
or by Jason
Published on 2011-01-15T02:47:45Z
Indexed on
2011/01/15
2:53 UTC
Read the original article
Hit count: 177
In phpMyAdmin under operations I can "Copy database to:" and select
- Structure and data
- CREATE DATABASE before copying
- Add AUTO_INCREMENT value
I need to be able to do that without using phpMyAdmin.
I know how to create the database and user. I have a source database that's a shell that I can work from so all I really need is the how to copy all the table structure and data part. (I know, the harder part)
system() & exec() are not options for me which rules out mysqldump. (I think)
How can I loop through each table and recreate it's structure and data?
Is it just looping through the results of
SHOW TABLES
then for each table looping through
DESCRIBE tablename
Then, is there an easy way for getting the data copied?
© Stack Overflow or respective owner