<?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>Wanderwort &#187; Server</title>
	<atom:link href="http://wanderwort.de/tag/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://wanderwort.de</link>
	<description>Interkulturelle Wortkolletionen in Ruby, PHP, XHTML, CSS nah am Strom der Gesellschaft</description>
	<lastBuildDate>Tue, 13 Jul 2010 11:58:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Cheatsheet: moving data from one server to another</title>
		<link>http://wanderwort.de/2010/01/20/moving-data-from-one-server-to-another/</link>
		<comments>http://wanderwort.de/2010/01/20/moving-data-from-one-server-to-another/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 06:00:11 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Arbeit]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=217</guid>
		<description><![CDATA[This article is about moving a running web-environment along with it&#8217;s MySQL database from one server to another via SSH. Compress files Let&#8217;s compress the directory we&#8217;re going to move using gzip: tar cfvz backup.tar.gz /path/ Dump MySQL database content mysqldump -uUser -p -hlocalhost database_name &#62; dump.sql You can also dump several databases with mysqldump [...]]]></description>
			<content:encoded><![CDATA[<p>This article is about moving a running web-environment along with it&#8217;s <a href="http://en.wikipedia.org/wiki/MySQL">MySQL</a> database from one server to another via <a href="http://en.wikipedia.org/wiki/Secure_Shell">SSH</a>.</p>
<h3>Compress files</h3>
<p>Let&#8217;s compress the directory we&#8217;re going to move using <a href="http://en.wikipedia.org/wiki/Gzip">gzip</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> cfvz backup.tar.gz <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

</p>
<h3>Dump MySQL database content</h3>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">-uUser</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-hlocalhost</span> database_name <span style="color: #000000; font-weight: bold;">&gt;</span> dump.sql</pre></div></div>

<p>You can also dump several databases with <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html">mysqldump</a> by addind the <code>--databases</code> or <code>--all-databases</code> parameter.</p>
<h3>Moving files</h3>
<p>Now we use <a href="http://en.wikipedia.org/wiki/Secure_Copy">SCP</a> to move files to our new machine. The following example copies from the old machine:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> user<span style="color: #000000; font-weight: bold;">@</span>host:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>backup.tar.gz .</pre></div></div>

<p>The other way round, copying the file to the new machine from the old one would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> backup.tar.gz user<span style="color: #000000; font-weight: bold;">@</span>host:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>backup.tar.gz</pre></div></div>

<p>Do the same with your database dump.
</p>
<h3>Uncompress files</h3>
<p>Simply type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xfvz backup.tar.gz</pre></div></div>

<p>Now we should have the same directory structure we had on our old machine.</p>
<h3>Import MySQL database</h3>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-uUser</span> <span style="color: #660033;">--default-character-set</span>=utf8 <span style="color: #660033;">-hlocalhost</span> <span style="color: #660033;">-p</span> database_name <span style="color: #000000; font-weight: bold;">&lt;</span> dump.sql</pre></div></div>

<p>If you have international content and an utf-8 environment running don&#8217;t forget to pass the charset-parameter!</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/01/20/moving-data-from-one-server-to-another/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
