Try Again Try Again - 4 months ago 15x
SQL Question

How we merge two database into new database using php

I have two databases in my phpmyadmin

test and test1
now I want to merge it into other database i.e

has 15 tables . Database
test 2
has 23 tables so that database
test 3
contain 15+23 i.e 38 table

I also check Merge two database into a single database and How can we merge two databases with identical schemas? link but not found any solution

How it can be done with the help of php??


With using php file you can dump of multiple database using exec() and mysqldump as

exec("mysqldump --user root -p --databases test1 test2 > file.sql");

This will export multiple database into one file now you can import database into test3 using

exec("mysql -u username -p test3 < file.sql");