Backup MySQL with Python

#!/usr/bin/python #purpose: backup mysql database usin mysqldump # date: 05.07.2009 # S.Kraneis import os import time DESTDIR=’/home/kraneis/python/backup/’ USERNAME=’root’ PASSWORD=’testpw’ DATE= time.strftime(“%Y-%m-%d”) DBLIST = [“testdb”] def DUMP_CMD(x): # cmd = “mysqldump –add-drop-table -u %s -p%s %s > %s%s-%s.sql” % (USERNAME,PASSWORD,x,DESTDIR,x,DATE) cmd1 = “mysqldump –add-drop-table -u ” + USERNAME + ” -p” + PASSWORD + ” ” […]

Tagged ,