<?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>/kb &#187; mysql</title>
	<atom:link href="http://grx.no/kb/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://grx.no/kb</link>
	<description>personal knowledgebase</description>
	<lastBuildDate>Wed, 15 Jun 2011 07:07:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>#1064 &#8211; You have an error in your SQL syntax</title>
		<link>http://grx.no/kb/2009/03/04/1064-you-have-an-error-in-your-sql-syntax/</link>
		<comments>http://grx.no/kb/2009/03/04/1064-you-have-an-error-in-your-sql-syntax/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 09:28:12 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=99</guid>
		<description><![CDATA[When exporting and importing from and to different MySQL databases with diferent version numbers this error message might show up: #1064 &#8211; You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ENGINE=MyISAM DEFAULT CHARSET=utf8′ I got the message when [...]]]></description>
			<content:encoded><![CDATA[<p>When exporting and importing from and to different MySQL databases with diferent version numbers this error message might show up:</p>
<blockquote><p>#1064 &#8211; You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ENGINE=MyISAM DEFAULT CHARSET=utf8′</p></blockquote>
<p>I got the message when exporting from a MySQL 5.x database and importing to a MySQL 4.x database. The solution came to me from the following <a href="http://superaff.com/archives/2005/08/31/moving-hosts-mysql-errors/#comment-279">blog post comment</a> and is very easy. Just add the <code>--compatible</code> option:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysqldump <span style="color: #CC0099;">-</span>u username <span style="color: #CC0099;">-</span>ppassword –compatible<span style="color: #CC0099;">=</span>mysql40 database_name <span style="color: #CC0099;">&gt;</span> FILENAME.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/03/04/1064-you-have-an-error-in-your-sql-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing a MySQL dump file</title>
		<link>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/</link>
		<comments>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 17:58:32 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=88</guid>
		<description><![CDATA[mysql -h SERVER -uUSER -p DATABASE &#60; DUMPFILE]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-h</span> SERVER <span style="color: #660033;">-uUSER</span> <span style="color: #660033;">-p</span> DATABASE <span style="color: #000000; font-weight: bold;">&lt;</span> DUMPFILE</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a new MySQL-user with all privileges</title>
		<link>http://grx.no/kb/2008/05/17/create-a-new-mysql-user-with-all-privileges/</link>
		<comments>http://grx.no/kb/2008/05/17/create-a-new-mysql-user-with-all-privileges/#comments</comments>
		<pubDate>Sat, 17 May 2008 17:26:24 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=17</guid>
		<description><![CDATA[GRANT ALL PRIVILEGES ON thedatabase.* TO 'theusername'@'localhost' IDENTIFIED BY 'thepassword' WITH GRANT OPTION; UPDATE 20080916: Skip the last line if the user exists.]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> thedatabase.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'theusername'</span>@<span style="color: #008000;">'localhost'</span>
	IDENTIFIED BY <span style="color: #008000;">'thepassword'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span></pre></div></div>

<p>UPDATE 20080916: Skip the last line if the user exists.</p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/17/create-a-new-mysql-user-with-all-privileges/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup a MySQL database with mysqldump</title>
		<link>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/</link>
		<comments>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/#comments</comments>
		<pubDate>Wed, 14 May 2008 16:29:50 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=13</guid>
		<description><![CDATA[It&#8217;s very easy, but I always have to look it up. mysqldump --opt -u USERNAME -p -h HOST.HOST.COM DATABASE_TABLE &#62; DUMPFILE.sql]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very easy, but I always have to look it up.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">--opt</span> <span style="color: #660033;">-u</span> USERNAME <span style="color: #660033;">-p</span> <span style="color: #660033;">-h</span> HOST.HOST.COM DATABASE_TABLE <span style="color: #000000; font-weight: bold;">&gt;</span> DUMPFILE.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Join tables in MySQL</title>
		<link>http://grx.no/kb/2008/04/21/join-tables-in-mysql/</link>
		<comments>http://grx.no/kb/2008/04/21/join-tables-in-mysql/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 07:45:22 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=7</guid>
		<description><![CDATA[Join three tables (shows, bands, locations) in MySQL: select * from shows left join &#40;bands, locations&#41; ON &#40;bands.id = shows.band_id and locations.id = shows.location_id&#41;; For further information see MySQL Reference manual 12.2.7.1. JOIN Syntax.]]></description>
			<content:encoded><![CDATA[<p>Join three tables (shows, bands, locations) in MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">from</span> shows 
<span style="color: #000099;">left</span> <span style="color: #990099; font-weight: bold;">join</span> <span style="color: #FF00FF;">&#40;</span>bands<span style="color: #000033;">,</span> locations<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ON</span> 
<span style="color: #FF00FF;">&#40;</span>bands.id <span style="color: #CC0099;">=</span> shows.band_id <span style="color: #CC0099; font-weight: bold;">and</span> locations.id <span style="color: #CC0099;">=</span> shows.location_id<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p>For further information see MySQL Reference manual <a href="http://dev.mysql.com/doc/refman/5.0/en/join.html">12.2.7.1. JOIN Syntax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/04/21/join-tables-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

