You are here: Re: backing up mysql question « All PHP « IT news, forums, messages
Re: backing up mysql question

Posted by jdbartlett on 08/13/07 20:39

On Aug 13, 3:31 pm, rebecca...@gmail.com wrote:
> On Aug 13, 3:29 pm, jdbartlett <cont...@jdbartlett.com> wrote:
>
> > On Aug 13, 3:23 pm, rebecca...@gmail.com wrote:
>
> > > Usually, I log into phpMyAdmin to export the entire SQL DB. Is there
> > > any separate PHP code way to do this without logging in there?
>
> > You could call mysqldump from the command line. If you have a large
> > database to export, you may want to compress it, too. Assuming you
> > use Linux, the command will look something like this:
>
> > mysqldump --compact --compress -uYOURUSERNAME -pYOURPASSWORD
> > DATABASENAME | gzip --best > FILENAME
>
> :)
> So, there is no way via <? php code ?> to sign-in, export?

The easiest method to get a complete backup would be to call mysqldump
using the 'system' command, like so:

<?php


$username = 'YOURUSERNAME';
$password = 'YOURPASSWORD';
$database = 'DATABASENAME';
$filename = 'FILENAME';

system("mysqldump --compact --compress -u{$username} -p{$password}
> {$database} | gzip --best > {$filename}");

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация