How to clone MySQL database schema in PHP
06 Feb 2011 Matteo Mattei mysql phpFor my client I needed to create a PHP script that can export a full MySQL database schema in another database. This script also need to keep and set constraints.
You only need to configure $DB_SRC_*
and $DB_DST_*
variables to fit your environment.
Here below you can find the code I created for this purpose:
Update 2016-10-14: The code below has been rewritten using PHP mysqli driver (thanks to Richard Maurer).