snipt

Ctrl+h for KB shortcuts

Bash

dump a database on one server and load it on another

1
2
3
4
# server
mysqldump -u<user> -p<pass> database | nc -l -p <port>
# client
nc <server> <port> | mysql -u<user> -p<pass> database
https://snippets.siftie.com/embed/c4801dc7574c2138cf8c0d8ccbac5042/
/raw/c4801dc7574c2138cf8c0d8ccbac5042/
c4801dc7574c2138cf8c0d8ccbac5042
bash
Bash
4
2019-03-20T21:12:28
True
False
False
/api/public/snipt/3695/
dump-a-database-on-one-server-and-load-it-on-another
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># server</span> </span><span id="L-2"><a name="L-2"></a>mysqldump -u&lt;user&gt; -p&lt;pass&gt; database <span class="p">|</span> nc -l -p &lt;port&gt; </span><span id="L-3"><a name="L-3"></a><span class="c1"># client</span> </span><span id="L-4"><a name="L-4"></a>nc &lt;server&gt; &lt;port&gt; <span class="p">|</span> mysql -u&lt;user&gt; -p&lt;pass&gt; database </span></pre></div> </td></tr></table>
mysql, netcat