Matteo Mattei

Hello, my name is Matteo Mattei and this is my personal website. I am computer engineer with a long experience in Linux system administration and web software development.

linkedin rss twitter google+ github facebook

How to clone MySQL database schema in PHP

phpmysql

For 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).

comments powered by Disqus