[Tutor] How to call mysqlcommand in Python , "mysqldump for backup "
nephish
nephish at xit.net
Wed Dec 28 14:20:36 CET 2005
Glad to help, glad you got it working too.!
shawn
On Wed, 2005-12-28 at 09:03 +0000, John Joseph wrote:
> --- nephish <nephish at xit.net> wrote:
>
> > ooh ooh, i know this one, i have python do this for
> > me every day !
> >
> > target_dir = '/path/to/where/you/want/to/dump'
> >
> > os.system("mysqldump --add-drop-table -c -u user
> > -ppassword database
> > table > "+target_dir+"/table.bak.sql")
> >
> > dont forget the p in front of your password !
> >
> > hope this helps
> >
> >
>
> Hi it helped me a lot ,
> I did my script like this for backing my zabbix
> database
>
> import os, time
> # difine the target directory
> target_dir = '/home/john/backup/z-b-weekly/zabbix'
>
> # in the formar year-month-day-hours-minute-secound
> # uses time module
> today = time.strftime('%Y-%m-%d-%H-%M-%S')
>
> # For testing purpose only I had kept %M %S , we can
> remove it later
> now = target_dir + today
>
> os.system("mysqldump -u root -pjohn zabbix >
> "+now+" " )
> Thanks A LOT
> Joseph
>
>
>
>
>
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list