Script de backup para o MySQL ou MariaDB

Segue um script simples de backup para o MySQL ou o MariaDB. O script tem como pré-requisito a criação de um usuário específico para backup, com privilégios restritos (altere o que está em vermelho e itálico):

#!/bin/bash

# backup_mysql.sh
# Script para backup simples de um ou mais bancos de dados MySQL/MariaDB

# Dados de conexão:
#------------------
host="localhost"
bancos="nome_do_banco" # Se mais de um, separar por espaços
usuario="nome_do_usuario"
senha="senha_do_usuario"
data=`date +"%Y-%m-%d_%H-%M-%S"`
arquivo="/path/do/diretorio/de/backup/${data}"

# Configura opções:
#------------------
opcoes="--add-drop-database --add-drop-table --add-locks --comments --complete-insert --create-options --disable-keys --default-character-set=utf8 --extended-insert --dump-date --lock-tables --order-by-primary --quick --routines --set-charset --triggers"

# Faz backup:
#------------
for i in `echo $bancos`
do
  mysqldump -h $host -u $usuario --password=$senha --databases $i -r ${arquivo}_${i}.sql
done

O script acima fará um backup de todos os bancos listados, gerando arquivos com o nome de: YYYY-MM-DD_HH-MI-SS_nome_do_banco.sql.

Obviamente o usuário que faz o backup deve ter permissão em todos os bancos de dados.

Agora configure o cron para rodar automaticamente o script e apagar os backups mais velhos que 5 dias. Coloque isso em seu crontab (altere o que está em vermelho itálico):

# Faz o backup do MySQL, todo dia as 19:00h:
00 19 * * * /path/ate/o/script/backup_mysql.sh


# Apaga os backups antigos do MySQL (backups com mais de 5 dias),
# todo dia as 19:30h:
30 19 * * * find /path/do/diretorio/de/backup -name "*.sql" -mtime +5 -exec rm -f {} \;

Agora você já tem um script simples para o backup de seus bancos de dados. Obviamente você deverá copiar esse backup para algum outro host ou mídia de backup.

1,074 thoughts on “Script de backup para o MySQL ou MariaDB”

  1. Pingback: shop adam eve
  2. Pingback: adam eve deal
  3. Pingback: pupilpath.skedula
  4. Pingback: Brazilian Hair
  5. Pingback: porn movie
  6. Pingback: porn movie
  7. Pingback: angeles & angels
  8. Pingback: hackers for hire
  9. Pingback: prediksi bola
  10. Pingback: configuraciones
  11. Pingback: هایک ویژن
  12. Pingback: 100% kona coffee
  13. Pingback: being in the army
  14. Pingback: dome tent for rent
  15. Pingback: software reviews
  16. Pingback: vibrator review
  17. Pingback: lion kona coffee
  18. Pingback: best kona coffee
  19. Pingback: beginner vibrator
  20. Pingback: realistic fun vibe
  21. Pingback: mini back massager
  22. Pingback: idea
  23. Pingback: adidas eqt
  24. Pingback: vibe vibrator
  25. Pingback: کفسابی
  26. Pingback: Buy Vigra
  27. Pingback: loja de bebe
  28. Pingback: sexy lingerie
  29. Pingback: anal for beginners
  30. Pingback: p spot stimulation
  31. Pingback: dildo base
  32. Pingback: کفسابی
  33. Pingback: strap on dildo
  34. Pingback: A&E G-Bunny Slim
  35. Pingback: kona coffee
  36. Pingback: seo marketing
  37. Pingback: wild orchid sex
  38. Pingback: mazon code receive
  39. Pingback: adult toy catalog
  40. Pingback: coupon adam et eve
  41. Pingback: best new sex toys
  42. Pingback: Sripatum
  43. Pingback: cheap g spot toys
  44. Pingback: lube oil for sex
  45. Pingback: ترمیم مو
  46. Pingback: RMUTT Thailand
  47. Pingback: هایک ویژن
  48. Pingback: Acrylic Glue
  49. Pingback: earn money online
  50. Pingback: senegal numerique
  51. Pingback: headaches
  52. Pingback: extra big dildo
  53. Pingback: Pinganillo
  54. Pingback: pictures
  55. Pingback: sex movie
  56. Pingback: strap on for women
  57. Pingback: Best Anal Toys
  58. Pingback: giant dildo
  59. Pingback: tongue vibe
  60. Pingback: buy vigra online
  61. Pingback: massage kit
  62. Pingback: best lubricant
  63. Pingback: Broke phone
  64. Pingback: sex toys for clit
  65. Pingback: Pocket Pussy
  66. Pingback: john holmes
  67. Pingback: خرید vpn
  68. Pingback: خرید کریو
  69. Pingback: خرید kerio
  70. Pingback: beginner dildo
  71. Pingback: خرید vpn
  72. Pingback: vibrator review
  73. Pingback: خرید کریو
  74. Pingback: Google+
  75. Pingback: best lube for anal
  76. Pingback: Mini vibrator
  77. Pingback: sex Maza
  78. Pingback: mumbai police
  79. Pingback: rotating vibrator
  80. Pingback: 卡巴熊
  81. Pingback: 美容外科
  82. Pingback: kona coffee beans
  83. Pingback: نماشویی
  84. Pingback: Fast Web Hosting
  85. Pingback: womens clothes
  86. Pingback: Éducation
  87. Pingback: read here
  88. Pingback: هايك ويژن
  89. Pingback: basics
  90. Pingback: aladdin porn
  91. Pingback: no deposit bonus
  92. Pingback: 90's hits
  93. Pingback: mp3 songs
  94. Pingback: وکیل
  95. Pingback: italian bracelet
  96. Pingback: Buy Dresses Online
  97. Pingback: اپل ایدی
  98. Pingback: خرید vpn
  99. Pingback: خرید vpn
  100. Pingback: K coffee
  101. Pingback: خرید vpn
  102. Pingback: نصب آنتن
  103. Pingback: Kon coffee
  104. Pingback: خرید vpn
  105. Pingback: my blog
  106. Pingback: vegas weddings
  107. Pingback: سئو سایت
  108. Pingback: 100 kona coffee
  109. Pingback: خرید vpn
  110. Pingback: coffee
  111. Pingback: خرید kerio
  112. Pingback: خرید vpn
  113. Pingback: خرید vpn
  114. Pingback: blog
  115. Pingback: خرید vpn
  116. Pingback: rsync hacks
  117. Pingback: persian rugs
  118. Pingback: خرید vpn
  119. Pingback: tam
  120. Pingback: خرید vpn
  121. Pingback: Rbx.rocks
  122. Pingback: malmö
  123. Pingback: termeh
  124. Pingback: what is a server
  125. Pingback: گوگل adwords
  126. Pingback: خرید vpn
  127. Pingback: خرید vpn
  128. Pingback: خرید vpn
  129. Pingback: گوگل adwords
  130. Pingback: Belize city inn
  131. Pingback: گوگل adwords
  132. Pingback: 脱毛
  133. Pingback: legíny nebbia
  134. Pingback: vpn
  135. Pingback: گوگل adwords
  136. Pingback: کولر مسجد
  137. Pingback: persian tar
  138. Pingback: resume samples
  139. Pingback: گوگل adwords
  140. Pingback: داهوا
  141. Pingback: domain
  142. Pingback: سیستم cctv
  143. Pingback: خرید vpn
  144. Pingback: خرید vpn
  145. Pingback: خرید vpn
  146. Pingback: سیستم cctv
  147. Pingback: خرید vpn
  148. Pingback: سیستم cctv
  149. Pingback: سیستم cctv
  150. Pingback: خرید vpn
  151. Pingback: خرید طلا
  152. Pingback: zand game
  153. Pingback: Global Geeks
  154. Pingback: خرید طلا
  155. Pingback: سیستم cctv
  156. Pingback: gratis inserate
  157. Pingback: خرید vpn
  158. Pingback: prostate wand
  159. Pingback: خرید vpn
  160. Pingback: drivers hp
  161. Pingback: kinky bondage
  162. Pingback: vibrator review
  163. Pingback: خرید طلا
  164. Pingback: clit vacuum review
  165. Pingback: g-spot vibrator
  166. Pingback: apron
  167. Pingback: health
  168. Pingback: credit repair
  169. Pingback: diet destinations
  170. Pingback: کولر 13000
  171. Pingback: خرید طلا
  172. Pingback: nipple toys
  173. Pingback: rabbit vibrators
  174. Pingback: large dildo
  175. Pingback: sex when sick
  176. Pingback: خرید طلا
  177. Pingback: cock rings
  178. Pingback: خرید vpn
  179. Pingback: خرید طلا
  180. Pingback: سیستم cctv
  181. Pingback: using a dildo
  182. Pingback: felnőttképzés
  183. Pingback: go to the website
  184. Pingback: Halal banter
  185. Pingback: small glass dildos
  186. Pingback: womanizer deluxe
  187. Pingback: anal
  188. Pingback: خرید طلا
  189. Pingback: dildo that cum
  190. Pingback: سیستم cctv
  191. Pingback: hp drivers
  192. Pingback: White crystal
  193. Pingback: hydroquinone
  194. Pingback: make money
  195. Pingback: early vibrators
  196. Pingback: organic turmeric
  197. Pingback: best mini vibrator
  198. Pingback: biohealth protein
  199. Pingback: pink vibrator
  200. Pingback: bahis siteleri
  201. Pingback: kona coffee beans
  202. Pingback: bahis siteleri
  203. Pingback: miniclip.com
  204. Pingback: fifa world cup
  205. Pingback: bahis siteleri
  206. Pingback: air swimmers shark
  207. Pingback: bahis siteleri
  208. Pingback: bahis siteleri
  209. Pingback: bahis siteleri
  210. Pingback: bahis siteleri
  211. Pingback: bahis siteleri
  212. Pingback: goldenbah's
  213. Pingback: vibrating ring her
  214. Pingback: Moleskin Jackets
  215. Pingback: bondage sex
  216. Pingback: best wand vibrator
  217. Pingback: Morgellons Cure
  218. Pingback: clit vibrator
  219. Pingback: clash royale hack
  220. Pingback: imoti varna
  221. Pingback: G-Spot Vibrator
  222. Pingback: strap-on dildo
  223. Pingback: solaray
  224. Pingback: dildo and penis
  225. Pingback: Democracy
  226. Pingback: video maza zone
  227. Pingback: matka result
  228. Pingback: jageze
  229. Pingback: dating app
  230. Pingback: Free SEO Submitter
  231. Pingback: dental cosmetics
  232. Pingback: today
  233. Pingback: Equipment
  234. Pingback: Tatuaje Chile
  235. Pingback: clean water
  236. Pingback: Laptop Repairs
  237. Pingback: psychic
  238. Pingback: Instagram unfollow
  239. Pingback: psychic
  240. Pingback: Resistance Bands
  241. Pingback: Vancouver Escorts
  242. Pingback: gps tracker
  243. Pingback: a blessing
  244. Pingback: slovari
  245. Pingback: resize image
  246. Pingback: first sex toy
  247. Pingback: Computer City
  248. Pingback: برش ليزر
  249. Pingback: ceneval de derecho
  250. Pingback: golf club sets
  251. Pingback: prayer
  252. Pingback: brazilian hair
  253. Pingback: remy hair
  254. Pingback: Indian hair
  255. Pingback: patriots pursuit
  256. Pingback: mens fashion-wear
  257. Pingback: finger vibrater
  258. Pingback: malaysian hair
  259. Pingback: peruvian hair
  260. Pingback: Trading
  261. Pingback: Fashion
  262. Pingback: light novel
  263. Pingback: nalubale rafting
  264. Pingback: Travel Blog
  265. Pingback: prazdniki kakie
  266. Pingback: tonsils
  267. Pingback: task management
  268. Pingback: univconstantine
  269. Pingback: pochinki t-shirt
  270. Pingback: sni
  271. Pingback: make me cum
  272. Pingback: abcd
  273. Pingback: Hydroquinone
  274. Pingback: Hydroquinone
  275. Pingback: sportotobet
  276. Pingback: Sharing economy
  277. Pingback: خرید vpn
  278. Pingback: VRLA battery
  279. Pingback: diy slime
  280. Pingback: Las Vegas Escorts
  281. Pingback: clit vibrator
  282. Pingback: huge dildo review
  283. Pingback: cheap
  284. Pingback: slovar vse
  285. Pingback: STAR
  286. Pingback: phones
  287. Pingback: strap-on dildo
  288. Pingback: prazdniki 2018
  289. Pingback: trah_net_621
  290. Pingback: make money online
  291. Pingback: Anal Butt Plug
  292. Pingback: Access Denined
  293. Pingback: huge dildo
  294. Pingback: kegel exercises
  295. Pingback: Rabbit Vibrators
  296. Pingback: best anal beads
  297. Pingback: dick pump
  298. Pingback: wand massager
  299. Pingback: Glass Dildo
  300. Pingback: prostate massager
  301. Pingback: film
  302. Pingback: best vibrators
  303. Pingback: sex inside moter
  304. Pingback: pesni skachat
  305. Pingback: best spanking toys
  306. Pingback: sex toy
  307. Pingback: sex toy review
  308. Pingback: Adult Toys
  309. Pingback: mens outlets
  310. Pingback: photos
  311. Pingback: today prediction
  312. Pingback: milf porn online
  313. Pingback: 21 maya 2851
  314. Pingback: DraftKings NFL
  315. Pingback: long sex in bed
  316. Pingback: Tire Pressure
  317. Pingback: forum
  318. Pingback: friv
  319. Pingback: Painters Brisbane
  320. Pingback: NBA DFS
  321. Pingback: College Basketball
  322. Pingback: College Football
  323. Pingback: clit stimulator
  324. Pingback: g spot rabbit
  325. Pingback: DraftKings NBA
  326. Pingback: سكس
  327. Pingback: how to
  328. Pingback: Live sex
  329. Pingback: holidays tomorrow
  330. Pingback: aflamsex
  331. Pingback: Monay conveter
  332. Pingback: rottweiler puppies
  333. Pingback: Xxx live sexy cams
  334. Pingback: Funny videos
  335. Pingback: Live sex
  336. Pingback: Tire change
  337. Pingback: Sexy live girls
  338. Pingback: oral sex lube
  339. Pingback: Freexxx
  340. Pingback: Sexy shemale
  341. Pingback: Porn video
  342. Pingback: Hot babe
  343. Pingback: Cheap iphone case
  344. Pingback: Iphone deal
  345. Pingback: best clit vibrator
  346. Pingback: Cases for iphone X
  347. Pingback: nihal seneviratne
  348. Pingback: horoscope scorpio
  349. Pingback: سكس
  350. Pingback: business marketing
  351. Pingback: how to orgasm
  352. Pingback: dildo perform
  353. Pingback: vibrators
  354. Pingback: سكس
  355. Pingback: MILF
  356. Pingback: سكس مترجم
  357. Pingback: DFS
  358. Pingback: see through thong
  359. Pingback: Dr Garo Kassabian
  360. Pingback: pcs
  361. Pingback: Google
  362. Pingback: Content marketing
  363. Pingback: defamation lawyer
  364. Pingback: summer camp china
  365. Pingback: facebook
  366. Pingback: kegel ball review
  367. Pingback: lesbian strap ons
  368. Pingback: lesbian strapon
  369. Pingback: mp3 songs
  370. Pingback: djpunjab mp4
  371. Pingback: click to go
  372. Pingback: click at this page
  373. Pingback: more on the page
  374. Pingback: click at this page
  375. Pingback: read further
  376. Pingback: Cat Portrait
  377. Pingback: check this out
  378. Pingback: here
  379. Pingback: find out more here
  380. Pingback: here
  381. Pingback: sex lubricant
  382. Pingback: women masturbating
  383. Pingback: using sex toys
  384. Pingback: best chicago dj
  385. Pingback: essayforme
  386. Pingback: Rabbit Vibrator
  387. Pingback: Anal Vibrator
  388. Pingback: Best Wand Massager
  389. Pingback: Wand Massager
  390. Pingback: Best Anal Lube
  391. Pingback: nipple erector set
  392. Pingback: poker 88
  393. Pingback: glass dildo review
  394. Pingback: chocolate vibrator
  395. Pingback: MILF Porn
  396. Pingback: mp3juices
  397. Pingback: tubidy mp3
  398. Pingback: masturbation toys
  399. Pingback: dildo review video
  400. Pingback: clit stimulator
  401. Pingback: lesbian vibrator
  402. Pingback: thrusting vibrator
  403. Pingback: sirius radio gift
  404. Pingback: clitoris massager
  405. Pingback: tolkovaniya snov
  406. Pingback: netflix free
  407. Pingback: iPhone 5 Charger
  408. Pingback: Tecnologia
  409. Pingback: best blowjob
  410. Pingback: notehub.org
  411. Pingback: مه ساز
  412. Pingback: play online games
  413. Pingback: click here
  414. Pingback: notehub.org
  415. Pingback: today holidays
  416. Pingback: find out more
  417. Pingback: nintendope
  418. Pingback: boston amazon
  419. Pingback: Laptop sell
  420. Pingback: Security Firm
  421. Pingback: male masturbator
  422. Pingback: auto taxi
  423. Pingback: vibrator designs
  424. Pingback: sex toy testing
  425. Pingback: datumoufukuiken
  426. Pingback: vibrating sex toys
  427. Pingback: Verbuchen
  428. Pingback: hawaii top news
  429. Pingback: interracial porn
  430. Pingback: Baby Highchair
  431. Pingback: Freemason Ring
  432. Pingback: häst
  433. Pingback: whatsapp
  434. Pingback: Anal Plug
  435. Pingback: Samsung wholesale
  436. Pingback: see more
  437. Pingback: notehub.org
  438. Pingback: click to go
  439. Pingback: Bondage Dominatrix
  440. Pingback: notehub.org
  441. Pingback: Huge Dildo
  442. Pingback: سكس
  443. Pingback: address
  444. Pingback: click for details
  445. Pingback: notehub.org
  446. Pingback: برامج
  447. Pingback: mp3 music download
  448. Pingback: vaginal tightening
  449. Pingback: dildo reviews
  450. Pingback: sex xlxx
  451. Pingback: best vibrator
  452. Pingback: Hale Server
  453. Pingback: dog seat booster
  454. Pingback: สมัครm88
  455. Pingback: Philly
  456. Pingback: Kona coffee brands
  457. Pingback: Download New Music
  458. Pingback: bail bond
  459. Pingback: 100% kona coffee
  460. Pingback: سكس
  461. Pingback: free app for pc
  462. Pingback: escape room
  463. Pingback: Dog Toys
  464. Pingback: Abraaj
  465. Pingback: hosting
  466. Pingback: best sex swing
  467. Pingback: electric bike
  468. Pingback: phenq benefits
  469. Pingback: free app for pc
  470. Pingback: Biz Carlton
  471. Pingback: seo service
  472. Pingback: free phone cases
  473. Pingback: lawyer

Comments are closed.