import mysql dump OR copy database with PHP

import mysql dump OR copy database with PHP

am 17.03.2007 00:01:57 von REMOVE-CAPSburnFORout

I know this has likely been asked a million times so I'm gonna keep it
brief.

1. I'm in need of creating clones of a database I'm using as a template.

2. I've got a dump that I'm currently using "exec('mysql -p dbname

3. I do NOT need a program like phpmyadmin or bigdump to do the
importing. I'm simply attempting to find a more elegant way to do this
in my script that is handling other features for me as well.


4. In the past(read early this morning) I managed to read the dump file,
remove the comments, explode it at the ";" to separate into individual
queries and build the table structure with this but I cannot get it
populate the tables with the data in the dump.

I'd LOVE to simply be able to copy the database like phpmyadmin does but
there doesn't seem to be an easy solution for that though earlier I saw
something about a replication master/client that seemed close but I
couldn't find enough about it...if that's the way to go, just tell me
and I'll do my reading.

All I need are pointers to where to find the info since most of the
links I've found are for end users and not programmers.


Thanks for reading this and for any pointers you may have.

Eric

Re: import mysql dump OR copy database with PHP

am 17.03.2007 00:27:47 von Shion

Eric H. wrote:
> I know this has likely been asked a million times so I'm gonna keep it
> brief.
>
> 1. I'm in need of creating clones of a database I'm using as a template.
>
> 2. I've got a dump that I'm currently using "exec('mysql -p dbname
>
IMHO this is an elegant solution to the whole, parsing the dump file and then
use sql queries and error checking for each query feels a bit overkill.

--

//Aho

Re: import mysql dump OR copy database with PHP

am 18.03.2007 00:56:31 von Mick White

Eric H. wrote:

> I know this has likely been asked a million times so I'm gonna keep it
> brief.
>
> 1. I'm in need of creating clones of a database I'm using as a template.
>
> 2. I've got a dump that I'm currently using "exec('mysql -p dbname
>
mysqldump -u username -ppassword databasename [tablename(s)]
Mick

>
> 3. I do NOT need a program like phpmyadmin or bigdump to do the
> importing. I'm simply attempting to find a more elegant way to do this
> in my script that is handling other features for me as well.
>
>
> 4. In the past(read early this morning) I managed to read the dump file,
> remove the comments, explode it at the ";" to separate into individual
> queries and build the table structure with this but I cannot get it
> populate the tables with the data in the dump.
>
> I'd LOVE to simply be able to copy the database like phpmyadmin does but
> there doesn't seem to be an easy solution for that though earlier I saw
> something about a replication master/client that seemed close but I
> couldn't find enough about it...if that's the way to go, just tell me
> and I'll do my reading.
>
> All I need are pointers to where to find the info since most of the
> links I've found are for end users and not programmers.
>
>
> Thanks for reading this and for any pointers you may have.
>
> Eric