<?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>GibbonsR.net &#187; mysql</title>
	<atom:link href="http://gibbonsr.net/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://gibbonsr.net</link>
	<description>A Placeholder For My Ramblings</description>
	<lastBuildDate>Wed, 14 Jul 2010 14:52:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>MySQL Backup with UTF-8 Data</title>
		<link>http://gibbonsr.net/2009/12/mysql-backup-with-utf-8-data/</link>
		<comments>http://gibbonsr.net/2009/12/mysql-backup-with-utf-8-data/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 21:43:29 +0000</pubDate>
		<dc:creator>insanity5902</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://gibbonsr.net/?p=106</guid>
		<description><![CDATA[I&#8217;ve never given character sets and encoding much time. I half way understand how it works, which for me is unusual. I normally have to understand things at a level that lets me talk to the subject fairly well. And sadly, this one I don&#8217;t. I don&#8217;t have the time or energy to really dive [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve never given character sets and encoding much time. I half way understand how it works, which for me is unusual. I normally have to understand things at a level that lets me talk to the subject fairly well. And sadly, this one I don&#8217;t. I don&#8217;t have the time or energy to really dive into it right now, but it is on my list. I will talk briefly about what I have found in the last 24 hours about this.</p>
<p>MySQL allows you set to set the character-set and collation to utf-8. To my understanding this will allow you to store UTF-8 data in your database. This makes it really nice when you have users copying and pasting data into your CMS. It will store the special double-quotes, trademark symbols, and pretty much anything else you can throw at it. No big deal to backup up, right? Well I did an export within PHPMyAdmin and using the mysqldump utility. Neither one worked, and I was pissed. And actually so was the client because I didn&#8217;t catch it before we launched the site. So last night I was frantically searching Google as fast as I could (notice I wasn&#8217;t searching the web, I was searching Google &#8211; that should make an interesting blog post for another time). And I eventually found my answer. It had to do with the mediums inbetween the export and import to support utf-8 characters &#8211; Great.</p>
<p>So without having to use a 3rd party app, or write some code, I was able to figure out how to do it with myqldump. Instead of using the greater than symbol to redirect the output into a file, mysqldump has a switch -r to use to redirect output into a file. They say to use it on Windows machines, so I kind of felt dirty for using in the linux command line :/ But I did, and guess what, an import using virtualmin on the production server and everything worked, the data came across cleanly.</p>
<p>From the brief reading that I did, using the power of output redirection at the unix command line can break UTF-8 encoding. I guess it kind of makes sense if the server or terminal you are using doesn&#8217;t support it. But it isn&#8217;t something I would really think about.</p>
<p>Just for those wondering what I ended up doing. I normally do a mysqldump like</p>
<p style="padding-left: 30px;"><code>mysqldump -u user_name -p database_name &gt; mydump.sql</code></p>
<p>This time around, i just had to change it to</p>
<p style="padding-left: 30px;"><code>mysqldump -u user_name -p database_name -r mydump.sql</code></p>
<p>So simple I could throw up.</p>
]]></content:encoded>
			<wfw:commentRss>http://gibbonsr.net/2009/12/mysql-backup-with-utf-8-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
