<?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>Brain Goo &#187; mysql</title>
	<atom:link href="http://www.popmartian.com/tipsntricks/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.popmartian.com/tipsntricks</link>
	<description>Carpe Crap 'em</description>
	<lastBuildDate>Mon, 10 Oct 2011 14:42:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SQL: Select duplicate rows, select indistinct rows</title>
		<link>http://www.popmartian.com/tipsntricks/2008/10/27/sql-select-duplicate-rows-select-indistinct-rows/</link>
		<comments>http://www.popmartian.com/tipsntricks/2008/10/27/sql-select-duplicate-rows-select-indistinct-rows/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 16:09:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=67</guid>
		<description><![CDATA[Using SQL, MySQL or whatever your favorite database may be, we all know using SELECT DISTINCT will return unique values in case a value appears more than once in a table. How do you fine duplicates? What if I want to know where the duplicates are? The trick is to use count() and compare it [...]]]></description>
			<content:encoded><![CDATA[<p>Using SQL, MySQL or whatever your favorite database may be, we all know using <code>SELECT DISTINCT</code> will return unique values in case a value appears more than once in a table.</p>
<p>How do you fine duplicates?  What if I want to know where the duplicates are?</p>
<p>The trick is to use count() and compare it to an integer.</p>
<p><code>SELECT count(*), locations.* FROM locations GROUP BY number HAVING COUNT(*) > 1</code></p>
<p>That will select a count of unique instances of a value from a table called &#8220;locations&#8221;, group them by a field called &#8220;number&#8221; where the count is greater than 1.  In other words, it will return all the fields where there are more than one instance of the same value in the column &#8220;number&#8221;.</p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=67&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2008/10/27/sql-select-duplicate-rows-select-indistinct-rows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change or recover MySQL root password</title>
		<link>http://www.popmartian.com/tipsntricks/2008/09/22/change-or-recover-mysql-root-password/</link>
		<comments>http://www.popmartian.com/tipsntricks/2008/09/22/change-or-recover-mysql-root-password/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 16:02:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=41</guid>
		<description><![CDATA[To Change a Known Password If you know the current password, use one of these methods to reset it.  If you do not know, skip ahead to the next section. Using mysqladmin if there is no password: $ mysqladmin -u root password &#60;new password&#62; Using mysqladmin if there is a password: $ mysqladmin -u root [...]]]></description>
			<content:encoded><![CDATA[<p><strong>To Change a Known Password</strong><br />
If you know the current password, use one of these methods to reset it.  If you do not know, skip ahead to the next section.</p>
<p><strong>Using mysqladmin if there is no password:</strong></p>
<p><code>$ mysqladmin -u root password &lt;new password&gt;</code></p>
<p><strong>Using mysqladmin if there is a password:</strong><br />
<code>$ mysqladmin -u root -p &lt;old password&gt; &lt;new password&gt;</code></p>
<p><strong>Using mysql shell if there is no password</strong><br />
<code>mysql -u root<br />
mysql&gt; update user set password=PASSWORD("&lt;new password&gt;") where User='root';<br />
mysql&gt; flush privileges;<br />
mysql&gt; quit</code></p>
<p><strong>Using mysql shell if there is a password</strong><br />
<code>mysql -u root -p<br />
Password: &lt;old password&gt;<br />
mysql&gt; update user set password=PASSWORD("&lt;new password&gt;") where User='root';<br />
mysql&gt; flush privileges;<br />
mysql&gt; quit</code></p>
<p><strong>Recover/reset the password if you don&#8217;t know it</strong><br />
There is no way to recover the password if you don&#8217;t know it, but you can reset it to something new.<br />
You must have root on the box for this.</p>
<ol>
<li>Kill the running server</li>
<li>Create a text file with the following contents:<br />
<code>UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';<br />
FLUSH PRIVILEGES;</code></li>
<li>Run the mysql_safe binary with the <code>--init-file</code> option pointing to your new file like this:<br />
<code>mysqld_safe --init-file=/path/to/file &amp;</code></li>
<li>Delete the init file you created.</li>
<li>Stop and start MySQL normally.</li>
</ol>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=41&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2008/09/22/change-or-recover-mysql-root-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

