Python 自动备份Mysql脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| #!/usr/bin/env python
import os
import time
# 连接参数
username = root
password = 123456
hostname = localhost
# 获取时间
filestamp = time.strftime('%Y-%m-%d')
# 获取数据列表并备份
database_list_command="mysql -u %s -p%s -h %s --silent -N -e 'show databases'" % (username, password, hostname)
for database in os.popen(database_list_command).readlines():
database = database.strip()
if database == 'information_schema':
continue
filename = "/backups/mysql/%s-%s.sql" % (database, filestamp)
os.popen("mysqldump -u %s -p%s -h %s -e --opt -c %s | gzip -c > %s.gz" % (username, password, hostname, database, filename)) |
#!/usr/bin/env python
import os
import time
# 连接参数
username = root
password = 123456
hostname = localhost
# 获取时间
filestamp = time.strftime('%Y-%m-%d')
# 获取数据列表并备份
database_list_command="mysql -u %s -p%s -h %s --silent -N -e 'show databases'" % (username, password, hostname)
for database in os.popen(database_list_command).readlines():
database = database.strip()
if database == 'information_schema':
continue
filename = "/backups/mysql/%s-%s.sql" % (database, filestamp)
os.popen("mysqldump -u %s -p%s -h %s -e --opt -c %s | gzip -c > %s.gz" % (username, password, hostname, database, filename))
13 条评论
buy androxal uk pharmacy
buying androxal price singapore
buy enclomiphene generic alternative
how to buy enclomiphene australia pharmacy
cheapest buy rifaximin retail price
buy cheap rifaximin australia discount
xifaxan mail order uk
ordering xifaxan generic work
purchase staxyn spain over the counter
buy staxyn us pharmacies
how to order avodart purchase uk
how to order avodart buy online no prescription
order flexeril cyclobenzaprine canada medicine
how to order flexeril cyclobenzaprine purchase line
buy dutasteride australia no prescription
discount dutasteride cheap next day delivery
buy cheap gabapentin uk buy over counter
gabapentin saturday delivery
medicament kamagra distribuer ses
medicament kamagra pharmacie envoyer annuaire
get fildena generic uk
ordering fildena no rx needed
purchase itraconazole american pharmacy
how to buy itraconazole generic medications
předpis kamagra cod
100 mg kamagra