Re: One Button DB backup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 5, 2016 at 3:41 PM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote:

>
> > On Nov 5, 2016, at 10:12 AM, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx>
> wrote:
> >
> > On Fri, Nov 04, 2016 at 01:14:37PM -0400, Tedd Sperling wrote:
> >
> >> Hi gang:
> >>
> >> I am in need of a one-button backup of a database via a php script
> >>
> >> Anyone have any suggestions, comments, code?
> >>
> >
> > What I like about SQLite is that it's generally a single file which can
> > be copied out. As I recall, MySQL has a cluster of files which can be
> > done the same way, if you can find which directory they reside in.
> > PostgreSQL is a lost cause. The files are all in one place, but the
> > names are weird.
> >
> > If you can't use the shell (from inside PHP) to run the "dump" commands
> > for the DBMS involved, the last way I know is to use the SQL standard
> > "information_schema" view(s) to get at the schema for the database, and
> > then iterate over the results to fetch the individual table contents.
> >
> > If you're looking for an off-the-shelf solution (push button, suck
> > data), I don't know one.
> >
> > Paul
>
> Paul:
>
> I can download the entire database via phpMyAdmin — it’s quite simple —
> just export.
>
> I know I did it some time ago, but I can’t find the code.
>
> So, I was hoping someone had written a db export.
>
> In any event, thanks.
>
> Cheers,
>
> tedd
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Something like this little bit of code works:

$command = "mysqldump --add-drop-table -h localhost " .
 "-u USERNAME -p PASSWORD DBNAME > FILETOPIPETO";
$ret_val = null;
// create current backup
$output = system($command, $ret_val);

Adam

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux