<?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>Developer&#039;s Mind &#187; MySQL</title>
	<atom:link href="http://developersmind.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://developersmind.com</link>
	<description>Creative Rumblings of a Workaholic Developer!</description>
	<lastBuildDate>Tue, 27 Jul 2010 15:10:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Import and Export Data in MySQL</title>
		<link>http://developersmind.com/2009/06/20/importing-and-exporting-data-in-mysql-using-mysqldump/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=importing-and-exporting-data-in-mysql-using-mysqldump</link>
		<comments>http://developersmind.com/2009/06/20/importing-and-exporting-data-in-mysql-using-mysqldump/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 14:51:32 +0000</pubDate>
		<dc:creator>Pete Mall</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.developersmind.com/?p=25</guid>
		<description><![CDATA[MySQL is a popular open source Relational DataBase Management System (RDBMS) based on Structured Query Language. MySQL is the database of choice for the most popular open source project like WordPress, Joomla, phpBB, osCommerce, and other software built on the LAMP (Linux, Apache, MySQL, PHP) stack. When managing an application on the LAMP stack, sooner or later, you would want to backup the database or restore from a backup. <a href="http://developersmind.com/2009/06/20/importing-and-exporting-data-in-mysql-using-mysqldump/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>MySQL is a popular open source Relational DataBase Management System (RDBMS) based on Structured Query Language. MySQL is the database of choice for the most popular open source project like WordPress, Joomla, phpBB, osCommerce, and other software built on the LAMP (Linux, Apache, MySQL, PHP) stack. When managing an application on the LAMP stack, sooner or later, you would want to backup the database or restore from a backup.</p>
<h3>How to Export a MySQL Database to a SQL Dump File</h3>
<p>The easiest way to do this is to use the <strong>mysqldump</strong> command from the shell:</p>
<pre class="brush: sql; gutter: false;">mysqldump -u USERNAME -p DATABASE &gt; FILENAME.sql</pre>
<p>After you execute the command, you will be prompted for your password and the entire contents of the DATABASE will be dumped to FILENAME.sql.The dump contains the create and insert commands for all the tables and you don&#8217;t need to worry about anything at this point.<br />
It is advisable to create regular backups of your database in case of a failure. You can always restore from this dump and back online in no time.</p>
<h3>How to Import a MySQL Database From a SQL Dump File</h3>
<p>You can restore your database from a SQL dump file by passing the file using the mysql command from the shell:</p>
<pre class="brush: sql; gutter: false;">mysql -u USERNAME -p DATABASE &gt; FILENAME.sql</pre>
<p>After you execute the command, you will be asked for your password and the database will be restored from the SQL dump file.</p>
<h3>Advanced Options for Exporting and Importing</h3>
<p><strong>Backup Database Table Structure</strong><br />
If you want to backup the structure of the database tables without the data, you can use the <strong>&#8211;no-data</strong> switch:</p>
<pre class="brush: sql; gutter: false;">mysqldump -u USERNAME -p --no-data DATABASE &gt; FILENAME.sql</pre>
<p><strong>Backup Data Without Inserts</strong><br />
If you only want to backup the data without the database structure, you can use the <strong>&#8211;no-create-info</strong> switch:</p>
<pre class="brush: sql; gutter: false;">mysqldump -u USERNAME -p --no-create-info DATABASE &gt; FILENAME.sql</pre>
<p><strong>Backup Several Databases into One File</strong><br />
If you want to backup multiple databases into one file, you can use the &#8211;databases option to specify the multiple databases:</p>
<pre class="brush: sql; gutter: false;">mysqldump -u USERNAME -p --databases DATABASE1 DATABASE2... &gt; FILENAME.sql</pre>
<p><strong>Backup All Databases into One File</strong><br />
If you want to backup all databases on a server into one file, you can use the &#8211;all-databases option:</p>
<pre class="brush: sql; gutter: false;">mysqldump -u USERNAME -p --all-databases &gt; FILENAME.sql</pre>
<p><strong>Backup a Database Without Locking Tables</strong><br />
If you get an 1044 &#8220;Access Denied when using LOCK TABLES&#8221;, you can use the &#8211;lock-tables=false option to backup the database without locking the table:</p>
<pre class="brush: sql; gutter: false;">mysqldump -u USERNAME -p --lock-tables=false DATABASE &gt; FILENAME.sql</pre>
]]></content:encoded>
			<wfw:commentRss>http://developersmind.com/2009/06/20/importing-and-exporting-data-in-mysql-using-mysqldump/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
