Copying a database into a new database including structure and data
- by Jason
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?