Ofcourse, but simply copying the data generates tons of overhead.
Mysql has it's own functions for exporting and importing data, some which you can call through php (depending on where your db is).
Check out the mysql manual for commands mysqldump and mysqlimport,
and the SQL statements SELECT INTO OUTFILE and LOAD DATA INFILE.