<?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>itlivewire dev blog &#187; mysql</title>
	<atom:link href="http://itlivewire.com/devblog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://itlivewire.com/devblog</link>
	<description>Just another web development blog...</description>
	<lastBuildDate>Mon, 16 Apr 2012 12:37:26 +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>MySQL Duplicate entry for key PRIMARY on Auto_Increment</title>
		<link>http://itlivewire.com/devblog/2011/12/14/mysql-duplicate-entry-for-key-primary-on-auto_increment/</link>
		<comments>http://itlivewire.com/devblog/2011/12/14/mysql-duplicate-entry-for-key-primary-on-auto_increment/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 18:34:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://itlivewire.com/devblog/?p=452</guid>
		<description><![CDATA[Example errors: &#8220;Duplicate entry &#8217;123711155&#8242; for key &#8216;PRIMARY&#8217;&#8221; or &#8220;Duplicate entry &#8217;14676163&#8242; for key &#8217;1&#8242;&#8221; Most likely this happens for tables with more than 5 million records THE FIX The fix is to use repair table REPAIR TABLE &#60;TABLE_NAME&#62;; Note: Sometimes the duplicate error is also caused by your field type having the maximum value [...]]]></description>
			<content:encoded><![CDATA[<p>Example errors:</p>
<p>&#8220;Duplicate entry &#8217;123711155&#8242; for key &#8216;PRIMARY&#8217;&#8221; or &#8220;Duplicate entry &#8217;14676163&#8242; for key &#8217;1&#8242;&#8221;</p>
<p>Most likely this happens for tables with more than 5 million records</p>
<p>THE FIX</p>
<p>The fix is to use repair table </p>
<p><strong><code>REPAIR TABLE &lt;TABLE_NAME&gt;;</code></strong></p>
<p>Note: Sometimes the duplicate error is also caused by your field type having the maximum value already, for example in tinyint which has the maximum value of 127 so it better to use bigint for your auto ids, if this is not the case you can try the solution above.</p>
]]></content:encoded>
			<wfw:commentRss>http://itlivewire.com/devblog/2011/12/14/mysql-duplicate-entry-for-key-primary-on-auto_increment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MYSQL select items with twice or more instance in a table</title>
		<link>http://itlivewire.com/devblog/2009/12/10/mysql-select-items-with-twice-or-more-instance-in-a-table/</link>
		<comments>http://itlivewire.com/devblog/2009/12/10/mysql-select-items-with-twice-or-more-instance-in-a-table/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 09:43:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://itlivewire.com/devblog/?p=228</guid>
		<description><![CDATA[Lets say we have this table the ORDERS TABLE ID customer ordered &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- 1111 &#8211; John &#8211; pizza 2222 &#8211; Pete &#8211; salad 3333 &#8211; Rach &#8211; pizza 4444 &#8211; Maxx &#8211; pizza 5555 &#8211; Zigg &#8211; rice 1212 &#8211; Vinc &#8211; salad 4545 &#8211; Grac &#8211; sushi 1313 &#8211; Mark &#8211; cake 2424 &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets say we have this table the ORDERS TABLE</p>
<p>ID       customer      ordered<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1111  &#8211;  John       &#8211;     pizza<br />
2222  &#8211;  Pete       &#8211;    salad<br />
3333  &#8211;  Rach     &#8211;    pizza<br />
4444  &#8211;  Maxx        &#8211;     pizza<br />
5555 &#8211;   Zigg      &#8211;     rice<br />
1212  &#8211;  Vinc       &#8211;    salad<br />
4545  &#8211;  Grac      &#8211;    sushi<br />
1313  &#8211;  Mark       &#8211;    cake<br />
2424 &#8211;   Phils        &#8211;     salad<br/></p>
<p>We only want to show items which has been ordered <strong>more than 2 times</strong> here is our query<br/><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong><code>SELECT *,count(ordered) as cnt FROM ORDERS group by ordered having cnt > 2</code></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong>result:</strong><br />
1111  &#8211;  John       &#8211;     pizza<br />
3333  &#8211;  Rach     &#8211;    pizza<br />
4444  &#8211;  Maxx        &#8211;     pizza<br />
2222  &#8211;  Pete       &#8211;    salad<br />
1212  &#8211;  Vinc       &#8211;    salad<br />
2424 &#8211;   Phils        &#8211;     salad</p>
<p>We use here the <strong>having</strong> keyword</p>
<p>note: <strong>having</strong> will work if you have<strong> group by</strong> on your query</p>
]]></content:encoded>
			<wfw:commentRss>http://itlivewire.com/devblog/2009/12/10/mysql-select-items-with-twice-or-more-instance-in-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5.3 on Snow Leopard with mysqlnd</title>
		<link>http://itlivewire.com/devblog/2009/11/26/php-5-3-on-snow-leopard-with-mysqlnd/</link>
		<comments>http://itlivewire.com/devblog/2009/11/26/php-5-3-on-snow-leopard-with-mysqlnd/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 04:03:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[mysqlnd]]></category>
		<category><![CDATA[snow leopard]]></category>

		<guid isPermaLink="false">http://itlivewire.com/devblog/?p=189</guid>
		<description><![CDATA[On snow leopard the bundled version of PHP installed is 5.3 And it&#8217;s new PHP mysql driver is mysqlnd not the old one (ext/mysql) This might cause the following error: mysqlnd cannot connect to MySQL 4.1+ using old authentication Solution: type in mysql SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd'); Findings: Because mysqlnd has a bigger [...]]]></description>
			<content:encoded><![CDATA[<p>On snow leopard the bundled version of PHP installed is 5.3 And it&#8217;s new PHP mysql driver is mysqlnd not the old one (ext/mysql)</p>
<p>This might cause the following error:<br />
<strong>mysqlnd cannot connect to MySQL 4.1+ using old authentication</strong></p>
<p><strong>Solution:</strong><br />
type in mysql</p>
<pre class="brush: sql;">SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');</pre>
<p><strong>Findings:</strong><br />
Because mysqlnd has a bigger password hash it will not be compatible anymore with the password written beforehand.</p>
<p>Ref:<br />
<a href="http://dev.mysql.com/doc/refman/5.1/en/old-client.html">http://dev.mysql.com/doc/refman/5.1/en/old-client.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://itlivewire.com/devblog/2009/11/26/php-5-3-on-snow-leopard-with-mysqlnd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

