<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mysqldump Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/mysqldump/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Sun, 09 Sep 2018 11:17:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Making a Mysql database backup with Mysqldump</title>
		<link>https://www.osradar.com/making-a-mysql-database-backup-with-mysqldump/</link>
					<comments>https://www.osradar.com/making-a-mysql-database-backup-with-mysqldump/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Sun, 09 Sep 2018 11:17:32 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=5650</guid>

					<description><![CDATA[<p>A database is an elementary apart in the management of information within a company and is a vital component in information systems. Therefore, it is necessary to carry out operations that guarantee its optimal functioning. However, many times problems can occur that affect these data, so it is important to make constant backups of the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/making-a-mysql-database-backup-with-mysqldump/">Making a Mysql database backup with Mysqldump</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A <strong>database</strong> is an elementary apart in the management of information within a company and is a vital component in information systems. Therefore, it is necessary to carry out operations that guarantee its optimal functioning. However, many times problems can occur that affect these data, so it is important to make constant backups of the database. If you use <a href="https://www.mysql.com/">MySQL</a> you will be able to do it without problems with <strong>mysqldump</strong>.</p>
<p>The <strong>mysqldump</strong> client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfers to another SQL server.</p>
<h2>Basic use of Mysqldump</h2>
<p>The tool is a simple tool in its use but powerful for the possibilities and flexibility it offers you. Making a backup with mysqldump is really easy. I will show you:</p>
<ul>
<li><strong>Back up a single database:</strong></li>
</ul>
<p>This is the most basic form of use that mysqldump has. Thanks to this, I will backup a single database. Open a terminal and Run:</p>
<pre class="">:~# mysqldump -u root -p database &gt; output.sql</pre>
<figure id="attachment_5651" aria-describedby="caption-attachment-5651" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5651" src="https://www.osradar.com/wp-content/uploads/2018/09/1-3.png" alt="1.-Back up a single database" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/1-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/1-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/1-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/1-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/1-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/1-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/1-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5651" class="wp-caption-text">1.-Back up a single database with mysqldump</figcaption></figure>
<p>Please replace the name of the database with yours and output.sql with the name you want.</p>
<ul>
<li><strong>Make a backup of all databases:</strong></li>
</ul>
<p>But in some cases, I need to perform a Backup of all databases. To do this, run:</p>
<pre class="">:~# mysqldump -u root -p --all-databases &gt; output.sql</pre>
<figure id="attachment_5652" aria-describedby="caption-attachment-5652" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5652" src="https://www.osradar.com/wp-content/uploads/2018/09/2-3.png" alt="2.- Making a backup of all databases" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/2-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/2-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/2-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/2-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/2-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/2-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/2-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5652" class="wp-caption-text">2.- Making a full backup with mysqldump</figcaption></figure>
<p>Don&#8217;t forget to replace output with the name you want for your backup.</p>
<ul>
<li><strong>Back up multiple databases</strong></li>
</ul>
<p>And at other times, I need to perform backups of certain databases.</p>
<pre class="">:~# mysqldump -u root -p --databases database1 database2 &gt; output.sql</pre>
<figure id="attachment_5653" aria-describedby="caption-attachment-5653" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5653" src="https://www.osradar.com/wp-content/uploads/2018/09/3-3.png" alt="3.- Makiing a backup with mysqldump of some databases" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/3-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/3-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/3-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/3-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/3-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/3-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/3-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5653" class="wp-caption-text">3.- Making a backup with mysqldump of some databases</figcaption></figure>
<p>Again, I remind you to replace the data.</p>
<h2>Common mysqldump options</h2>
<p>There are many options to modify the execution of mysqldump, however, you can access them through the terminal</p>
<pre class="">:~# mysqldump --help</pre>
<figure id="attachment_5654" aria-describedby="caption-attachment-5654" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5654" src="https://www.osradar.com/wp-content/uploads/2018/09/4-4.png" alt="4.- Showing mysqldump help" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/4-4.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/4-4-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/4-4-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/4-4-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/4-4-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/4-4-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/4-4-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5654" class="wp-caption-text">4.- Showing mysqldump help</figcaption></figure>
<p>Here, I&#8217;ll show them to you with a brief description:</p>
<p>&#8211;compatible=nameChange the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL</p>
<table>
<tbody>
<tr>
<th style="text-align: center;" colspan="2" align="center">mysqldump options</th>
</tr>
<tr>
<td>Option</td>
<td>Description</td>
</tr>
<tr>
<td>-A, &#8211;all-databases</td>
<td>Dump all the databases</td>
</tr>
<tr>
<td>-Y, &#8211;all-tablespaces</td>
<td>Dump all the tablespaces</td>
</tr>
<tr>
<td>-y, &#8211;no-tablespaces</td>
<td>Do not dump any tablespace information</td>
</tr>
<tr>
<td>&#8211;add-drop-database</td>
<td>Add a DROP DATABASE before each create.</td>
</tr>
<tr>
<td>&#8211;add-drop-table</td>
<td>Add a DROP TABLE before each create.</td>
</tr>
<tr>
<td>-c, &#8211;complete-insert</td>
<td>Use complete insert statements</td>
</tr>
<tr>
<td>-C, &#8211;compress</td>
<td>Use compression in server/client protocol</td>
</tr>
<tr>
<td>-B, &#8211;databases</td>
<td>Dump several databases</td>
</tr>
<tr>
<td>-E, &#8211;events</td>
<td>Dump events</td>
</tr>
<tr>
<td>-F, &#8211;flush-logs</td>
<td>Flush logs file in server before starting dump</td>
</tr>
<tr>
<td>&#8211;flush-privileges</td>
<td>Emit a FLUSH PRIVILEGES statement after dumping the mysql database</td>
</tr>
<tr>
<td>-f, &#8211;force</td>
<td>Continue even if we get an SQL error</td>
</tr>
<tr>
<td>-h, &#8211;host=name</td>
<td>Connect to host</td>
</tr>
<tr>
<td>&#8211;ignore-table-name</td>
<td>Do not dump the specified table</td>
</tr>
<tr>
<td>-p, &#8211;password[=name]</td>
<td>Password to use when connecting to server</td>
</tr>
<tr>
<td>-P, &#8211;port=#</td>
<td>Port number to use for connection</td>
</tr>
<tr>
<td>&#8211;ssl</td>
<td>Enable SSL for connection</td>
</tr>
<tr>
<td>-u, &#8211;user=name</td>
<td>User for login if not current user</td>
</tr>
<tr>
<td>-v, &#8211;verbose</td>
<td>Print info about the various stages.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Of course, there are other options, but their use is less frequent.</p>
<p>As I said, mysqldump is a wonder and also allows you to compress the backup using gzip.</p>
<pre class="">:~#  mysqldump -u root -p --all-databases | gzip &gt; backup.sql.gz</pre>
<figure id="attachment_5656" aria-describedby="caption-attachment-5656" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5656" src="https://www.osradar.com/wp-content/uploads/2018/09/5-3.png" alt="5.- A backup with mysqldump using gzip" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/5-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/5-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/5-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/5-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/5-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/5-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/5-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5656" class="wp-caption-text">5.- A backup with mysqldump using gzip</figcaption></figure>
<p>Or, connect to a host:</p>
<pre class="">:~# mysqldump -h IP -u root -p --routines --all-databases  &gt; output.sql</pre>
<figure id="attachment_5657" aria-describedby="caption-attachment-5657" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5657" src="https://www.osradar.com/wp-content/uploads/2018/09/6-3.png" alt="6.- Connecting to a host to making a backup" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/6-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/6-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/6-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/6-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/6-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/6-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/6-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5657" class="wp-caption-text">6.- Connecting to a host to making a backup</figcaption></figure>
<h2>Restore a backup</h2>
<p>If the backup contains only one database and does not contain &#8216;drop database&#8217; and &#8216;create database&#8217; statements, then the database where the restoration should be performed can be indicated:</p>
<pre class="">:~# mysql -u root -p  database &lt; backup.sql</pre>
<figure id="attachment_5658" aria-describedby="caption-attachment-5658" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5658" src="https://www.osradar.com/wp-content/uploads/2018/09/7-4.png" alt="7.- Restoring a backup" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/7-4.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/7-4-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/7-4-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/7-4-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/7-4-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/7-4-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/7-4-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5658" class="wp-caption-text">7.- Restoring a backup</figcaption></figure>
<p>Or, if the backup is total, you can restore it as follows:</p>
<pre class="">:~# mysql -u root -p &lt; backup.sql</pre>
<figure id="attachment_5659" aria-describedby="caption-attachment-5659" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5659" src="https://www.osradar.com/wp-content/uploads/2018/09/8-3.png" alt="8.- Restoring a full backup" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/09/8-3.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/8-3-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/8-3-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/8-3-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/8-3-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/8-3-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/8-3-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5659" class="wp-caption-text">8.- Restoring a full backup</figcaption></figure>
<p>As you can see making a backup with mysqldump is really simple but at the same time is very important so I recommend you to further examine the options for you to get the most out of this tool.</p>
<p>We want to know your opinion, have you used mysqldump? What is your favorite option?</p>
<p>Please spread this article through your social networks</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/making-a-mysql-database-backup-with-mysqldump/">Making a Mysql database backup with Mysqldump</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/making-a-mysql-database-backup-with-mysqldump/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
