<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How can I preserve Unicode characters in `mysqdump`?</title>
	<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump/</link>
	<description>Comments on Ask MetaFilter post How can I preserve Unicode characters in `mysqdump`?</description>
	<pubDate>Mon, 28 Aug 2006 12:03:34 -0800</pubDate>
	<lastBuildDate>Mon, 28 Aug 2006 12:03:34 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How can I preserve Unicode characters in `mysqdump`?</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump</link>	
		<description>How can I make backups of a MySQL database (via &lt;code&gt;mysqldump&lt;/code&gt;) and preserve Unicode characters (such as em dashes)? &lt;br /&gt;&lt;br /&gt; I use &lt;code&gt;mysqldump&lt;/code&gt; and &lt;code&gt;rsync&lt;/code&gt; to make backups of my &lt;a href=&quot;http://textdrive.com/&quot; title=&quot;Welcome to TextDrive - Reliable, high performance web hosting you can trust&quot;&gt;TextDrive&lt;/a&gt; account. One of the forums I run, however, often includes unencoded Unicode entities, such as em dashes and bullets.&lt;br&gt;
&lt;br&gt;
Because these characters aren&apos;t straight ASCII, restoring from previous &lt;code&gt;mysqldump&lt;/code&gt; backups has mangled them, producing gibberish but preserving the other, straight ASCII text in the database.&lt;br&gt;
&lt;br&gt;
My current &lt;code&gt;mysqldump&lt;/code&gt; call looks like this: &lt;code&gt;/usr/local/bin/mysqldump -uuser -ppassword --quote-names --complete-insert --extended-insert --quick --lock-tables=false --skip-add-locks --all-databases | gzip &amp;gt; db.sql&lt;/code&gt;. What&apos;s necessary to preserve these Unicode characters?&lt;br&gt;
&lt;br&gt;
Thanks.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.45417</guid>
		<pubDate>Mon, 28 Aug 2006 11:55:32 -0800</pubDate>
		<dc:creator>cmyers</dc:creator>
		
			<category>mysql</category>
		
			<category>unicode</category>
		
			<category>database</category>
		
			<category>backup</category>
		
			<category>cron</category>
		
			<category>mysqldump</category>
		
			<category>charset</category>
		
	</item> <item>
		<title>By: pharm</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694319</link>	
		<description>&amp;lt;unhelpful remark&amp;gt;Use a real database?&amp;lt;/unhelpful remark&amp;gt;&lt;br&gt;
&lt;br&gt;
A little searching (actually, just stuffing &quot;mysqldump unicode&quot; into google) suggests that the argument --default-character-set=utf8 is what you want.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694319</guid>
		<pubDate>Mon, 28 Aug 2006 12:03:34 -0800</pubDate>
		<dc:creator>pharm</dc:creator>
	</item><item>
		<title>By: SpecialK</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694335</link>	
		<description>What pharm said, but you might also look into using mysqlhotcopy instead. If you&apos;re working with large datasets, re-importing the mysqldump output can take a long time (2 hours minutes for one of my customer&apos;s databases!) whereas mysqldump is almost instant.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694335</guid>
		<pubDate>Mon, 28 Aug 2006 12:12:01 -0800</pubDate>
		<dc:creator>SpecialK</dc:creator>
	</item><item>
		<title>By: SpecialK</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694337</link>	
		<description>err whereas mysqlhotcopy is almost instant. &lt;br&gt;
&lt;br&gt;
(I&apos;ve been writing code for far too long already today. :( )</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694337</guid>
		<pubDate>Mon, 28 Aug 2006 12:12:24 -0800</pubDate>
		<dc:creator>SpecialK</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694355</link>	
		<description>Use a binary dump.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694355</guid>
		<pubDate>Mon, 28 Aug 2006 12:26:43 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694356</link>	
		<description>&lt;small&gt;And yes, use a real database.&lt;/small&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694356</guid>
		<pubDate>Mon, 28 Aug 2006 12:27:14 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: cmyers</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694382</link>	
		<description>Sorry if the answer to my question was self-obviating. I did search, both here and via Google, but I didn&apos;t think to go for as simple as a string as &quot;mysqldump google&quot; would be adequate.&lt;br&gt;
&lt;br&gt;
Re &lt;code&gt;mysqlhotcopy&lt;/code&gt;: The largest of the databases is only about 2.3 MB, and the statement dumps give me greater flexibility among hosts and setups.&lt;br&gt;
&lt;br&gt;
Re MySQL: I know that it&apos;s a blunt instrument. My only other option is PostgreSQL, which I don&apos;t know but will look into.&lt;br&gt;
&lt;br&gt;
Thanks, and sorry for not looking much past my own nose.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694382</guid>
		<pubDate>Mon, 28 Aug 2006 12:50:10 -0800</pubDate>
		<dc:creator>cmyers</dc:creator>
	</item><item>
		<title>By: idontlikewords</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694457</link>	
		<description>oh dammit... mysqldump doesn&apos;t preserve unicode?! is idontlikewords gonna have to choke a bitch??</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694457</guid>
		<pubDate>Mon, 28 Aug 2006 13:51:09 -0800</pubDate>
		<dc:creator>idontlikewords</dc:creator>
	</item><item>
		<title>By: idontlikewords</title>
		<link>http://ask.metafilter.com/45417/How-can-I-preserve-Unicode-characters-in-mysqdump#694500</link>	
		<description>Hm... After a bit of monkeying around to remove some invalid comments that mysqldump inserted into my backups (which it is good that this thread prompted me to do), I was just able to restore a mysqldump backup with unicode chars, japanese chars and etc. All my tables are MyISAM and the charset is utf8.&lt;br&gt;
&lt;br&gt;
Here&apos;s the command I used to create the backup:&lt;br&gt;
&lt;br&gt;
mysqldump -h hostname.com -u username -ppassword --skip-comments --skip-lock-tables database-name &amp;gt; backup.sql&lt;br&gt;
&lt;br&gt;
And here&apos;s what I used to restore:&lt;br&gt;
&lt;br&gt;
mysql --user=username --password=password database &amp;lt; backup.sql</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.45417-694500</guid>
		<pubDate>Mon, 28 Aug 2006 14:30:15 -0800</pubDate>
		<dc:creator>idontlikewords</dc:creator>
	</item>
	</channel>
</rss>
