<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tips on Bitecode blog</title><link>https://bitecode.blog/categories/tips/</link><description>Recent content in Tips on Bitecode blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 02 Jun 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://bitecode.blog/categories/tips/index.xml" rel="self" type="application/rss+xml"/><item><title>Dumping large MySQL database</title><link>https://bitecode.blog/2016/05/14/mysql-dump-large-database/</link><pubDate>Thu, 02 Jun 2016 00:00:00 +0000</pubDate><guid>https://bitecode.blog/2016/05/14/mysql-dump-large-database/</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;Not going into details of credentials basic mysqldump command looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;mysqldump database &amp;gt; database_dump.sql
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Dump file size was ~3GB which might take quite long. Especially when the connection to mysql server was not fast enough.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;After a few attempts and noticing that it might take too long to fetch all data I found out that there is a nice switch in mysql and mysqldump commands.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;--compress, -C
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Switch will tell mysql server to compress the dump on the fly so you can save a lot of bandwidth. However both sides needs to support the setting. Note that you may also use that switch with mysql command.&lt;/p&gt;</description></item></channel></rss>