MySQL Database Duplication or Creation
I have a website that needs to recreate a database based off of a core .sql file.
Do any of you have functions that can read + query a .sql file
Or as an alternative, is there a way to clone databases within php? If so, I could just setup a "default" database, and just have the script duplicate it.
You'll have to provide a bit more detail if you want a PHP script solution; in general, you would typically use either the 'mysql monitor' command line client or phpMyAdmin to load a database from an SQL file.
This of course could be emulated with a one-off PHP script that either parses the file and runs a query based on that, or perhaps uses exec() to run the correct MySQL command line client for the task at hand.
It's also possible a single query using LOAD DATA INFILE or SOURCE could be used.
You can load a .sql file in phpMyAdmin, it will then create all the tables and if you chose for it, it will also copy your data in the tables.
|All times are GMT. The time now is 06:54 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0