snipt

Ctrl+h for KB shortcuts

Bash

Drop a database with mysqladmin

$ mysqladmin drop <database_name>
https://snipt.net/embed/a896471e220c8b078b875f25587dff41/
/raw/a896471e220c8b078b875f25587dff41/
a896471e220c8b078b875f25587dff41
bash
Bash
1
2019-07-19T16:29:39
True
False
False
/api/public/snipt/19237/
drop-a-database-with-mysqladmin
<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>$ mysqladmin drop &lt;database_name&gt; </span></pre></div> </td></tr></table>
mysql, mysqladmin

Bash

Restore MySQL databases from dump files

$ mysql -u [username] -p [database_name] < [dump_file_path]
https://snipt.net/embed/bae507dfeb25976f57fdf2768a0d0559/
/raw/bae507dfeb25976f57fdf2768a0d0559/
bae507dfeb25976f57fdf2768a0d0559
bash
Bash
1
2019-07-11T15:59:21
True
False
False
/api/public/snipt/11761/
restore-mysql-databases-from-dump-files
<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>$ mysql -u <span class="o">[</span>username<span class="o">]</span> -p <span class="o">[</span>database_name<span class="o">]</span> &lt; <span class="o">[</span>dump_file_path<span class="o">]</span> </span></pre></div> </td></tr></table>
mysql

Bash

mysqldump

$ mysqldump -u [username] -p [password] --databases [databasename] > [file_path]
https://snipt.net/embed/aed7d2073f4869bba3ca46a3bbd1944f/
/raw/aed7d2073f4869bba3ca46a3bbd1944f/
aed7d2073f4869bba3ca46a3bbd1944f
bash
Bash
1
2019-07-17T16:19:46
True
False
False
/api/public/snipt/11760/
mysqldump-1
<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 -u <span class="o">[</span>username<span class="o">]</span> -p <span class="o">[</span>password<span class="o">]</span> --databases <span class="o">[</span>databasename<span class="o">]</span> &gt; <span class="o">[</span>file_path<span class="o">]</span> </span></pre></div> </td></tr></table>
mysql, mysqldump