snipt

Ctrl+h for KB shortcuts

Bash

Backup and compress a MySQL DB

mysqldump $DB_NAME -R -q --user=$USER --password=$PASSWORD --lock-tables | gzip > $BACKUPDIR/$BACKUPNAME
https://snipt.net/embed/ded50795e42c5309713131ffdceee243/
/raw/ded50795e42c5309713131ffdceee243/
ded50795e42c5309713131ffdceee243
bash
Bash
2
2019-06-26T11:47:58
True
False
False
/api/public/snipt/6900/
backup-and-compress-a-mysql-db
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>mysqldump <span class="nv">$DB_NAME</span> -R -q --user<span class="o">=</span><span class="nv">$USER</span> --password<span class="o">=</span><span class="nv">$PASSWORD</span> --lock-tables <span class="p">|</span> gzip &gt; <span class="nv">$BACKUPDIR</span>/<span class="nv">$BACKUPNAME</span> </span></pre></div> </td></tr></table>
archive, backup, mysql, shell