<?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>MemoSoup &#187; mysql</title>
	<atom:link href="http://www.memosoup.com/tag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.memosoup.com</link>
	<description>Mix of the things I always forget</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:03:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>mySQL: How to reset root password</title>
		<link>http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html</link>
		<comments>http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html#comments</comments>
		<pubDate>Sun, 05 Feb 2012 22:48:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[reset]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=455</guid>
		<description><![CDATA[<p>If the password for the mysql &#8220;root&#8221; user is lost, it&#8217;s still possible reset it to some other value. The restart of the mySQL server will be necessary, of course.</p> <p>The following should be done:</p> <p>Stop the server It could be done normally:</p> /etc/init.d/mysql stop <p>or effectively:</p> ps -ef &#124; grep mysql ... mysql 25079 [...]]]></description>
			<content:encoded><![CDATA[<p>If the password for the mysql &#8220;root&#8221; user is lost, it&#8217;s still possible reset it to some other value.<br />
The restart of the mySQL server will be necessary, of course.</p>
<p>The following should be done:</p>
<p><strong>Stop the server</strong><br />
It could be done normally:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql stop</div></div>
<p>or effectively:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-ef</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> mysql<br />
...<br />
mysql <span style="color: #000000;">25079</span> <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000;">0</span> &nbsp; Jan <span style="color: #000000;">31</span> ? &nbsp;<span style="color: #000000;">0</span>:00 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysqld<br />
...<br />
<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">25079</span></div></div>
<p><em>Please ensure that the proper process is killed!</em></p>
<p><strong>Start MySQL server without security checking</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysqld_safe <span style="color: #660033;">--skip-grant-tables</span> <span style="color: #000000; font-weight: bold;">&amp;</span></div></div>
<p><strong>Connect to mySQL without password</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql <span style="color: #660033;">-u</span> root</div></div>
<p><strong>Reset mySQL root password</strong></p>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=USE"><span style="color: #990099; font-weight: bold;">use</span></a> mysql<span style="color: #000033;">;</span><br />
<a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=UPDATE"><span style="color: #990099; font-weight: bold;">update</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/information-functions.html"><span style="color: #000099;">user</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=SET"><span style="color: #990099; font-weight: bold;">set</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/encryption-functions.html"><span style="color: #000099;">password</span></a><span style="color: #CC0099;">=</span><a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/encryption-functions.html"><span style="color: #000099;">PASSWORD</span></a><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;NEW<span style="color: #008080; font-weight: bold;">_</span>PASSWORD&quot;</span><span style="color: #FF00FF;">&#41;</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=WHERE"><span style="color: #990099; font-weight: bold;">where</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/information-functions.html"><span style="color: #000099;">user</span></a><span style="color: #CC0099;">=</span><span style="color: #008000;">'root'</span><span style="color: #000033;">;</span><br />
flush <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=PRIVILEGES"><span style="color: #990099; font-weight: bold;">privileges</span></a><span style="color: #000033;">;</span></div></div>
<p>Use the real new password instead of the string &#8220;NEW_PASSWORD&#8221;.</p>
<p><strong>Restart mySQL server</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql stop<br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql start</div></div>
<p><strong>Check the connection</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20120206%2Fmysql-how-to-reset-root-password.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="mySQL: How to reset root password" data-url="http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql: rownum functionality</title>
		<link>http://www.memosoup.com/20091027/mysql-rownum-functionality.html</link>
		<comments>http://www.memosoup.com/20091027/mysql-rownum-functionality.html#comments</comments>
		<pubDate>Tue, 27 Oct 2009 10:45:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[rownum]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=211</guid>
		<description><![CDATA[<p>Here are some examples how to use &#8220;rownum&#8221; functionality (similar to Oracle) in mysql</p> UPDATE mytable SET col1 = 'somevalue' ORDER BY col2 LIMIT 300 <p>rownum analog:</p> SELECT @rownum:=@rownum+1 rownum, mytable.* FROM &#40;SELECT @rownum:=0&#41; r, mytable; Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>Here are some examples how to use &#8220;rownum&#8221; functionality (similar to Oracle) in mysql</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">UPDATE</span> mytable<br />
<span style="color: #993333; font-weight: bold;">SET</span> col1 <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'somevalue'</span><br />
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> col2<br />
<span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">300</span></div></div>
<p><strong>rownum</strong> analog:</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">SELECT</span> @rownum:<span style="color: #66cc66;">=</span>@rownum<span style="color: #66cc66;">+</span><span style="color: #cc66cc;">1</span> rownum<span style="color: #66cc66;">,</span> mytable<span style="color: #66cc66;">.*</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> @rownum:<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> r<span style="color: #66cc66;">,</span> mytable;</div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20091027%2Fmysql-rownum-functionality.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20091027/mysql-rownum-functionality.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="mysql: rownum functionality" data-url="http://www.memosoup.com/20091027/mysql-rownum-functionality.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20091027/mysql-rownum-functionality.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mySQL: size of the database</title>
		<link>http://www.memosoup.com/20091016/mysql-size-of-the-database.html</link>
		<comments>http://www.memosoup.com/20091016/mysql-size-of-the-database.html#comments</comments>
		<pubDate>Fri, 16 Oct 2009 15:23:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[size]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=204</guid>
		<description><![CDATA[SELECT table_schema &#34;Database&#34;, &#160;SUM&#40; data_length + index_length &#41; / 1024 / 1024 &#34;Size (MB)&#34;, &#160;SUM&#40; data_free &#41;/ 1024 / 1024 &#34;Free (MB)&#34; FROM information_schema.TABLES GROUP BY table_schema ; <p>This will work in mySQL 5.0.2 and newer. Use SHOW TABLE STATUS command for other versions.</p> Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">SELECT</span> table_schema <span style="color: #ff0000;">&quot;Database&quot;</span><span style="color: #66cc66;">,</span> <br />
&nbsp;<span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span> data_length <span style="color: #66cc66;">+</span> index_length <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span> <span style="color: #ff0000;">&quot;Size (MB)&quot;</span><span style="color: #66cc66;">,</span> <br />
&nbsp;<span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span> data_free <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span> <span style="color: #ff0000;">&quot;Free (MB)&quot;</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> information_schema<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">TABLES</span><br />
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> table_schema ;</div></div>
<p>This will work in mySQL 5.0.2 and newer. Use <strong>SHOW TABLE STATUS</strong> command for other versions.</p>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20091016%2Fmysql-size-of-the-database.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20091016/mysql-size-of-the-database.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="mySQL: size of the database" data-url="http://www.memosoup.com/20091016/mysql-size-of-the-database.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20091016/mysql-size-of-the-database.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL: start SQL from shell script</title>
		<link>http://www.memosoup.com/20090918/mysql-start-sql-from-shell-script.html</link>
		<comments>http://www.memosoup.com/20090918/mysql-start-sql-from-shell-script.html#comments</comments>
		<pubDate>Fri, 18 Sep 2009 15:15:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[start]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=134</guid>
		<description><![CDATA[<p>The following code starts the SQL from the shell script directly, without additional SQL file</p> #!/bin/sh --/. &#38;&#62; /dev/null; exec mysql &#34;$@&#34; select 'Hello, world!' as test ; <p>The detailed explanation of the trick is here</p> Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>The following code starts the SQL from the shell script directly, without additional SQL file</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
--<span style="color: #000000; font-weight: bold;">/</span>. <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null; <span style="color: #7a0874; font-weight: bold;">exec</span> mysql <span style="color: #ff0000;">&quot;$@&quot;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">select</span> <span style="color: #ff0000;">'Hello, world!'</span> <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #7a0874; font-weight: bold;">test</span> ;</div></div>
<p>The detailed explanation of the trick is <a HREF="http://www.futhark.ch/mysql/144.html">here</a></p>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090918%2Fmysql-start-sql-from-shell-script.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090918/mysql-start-sql-from-shell-script.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="MySQL: start SQL from shell script" data-url="http://www.memosoup.com/20090918/mysql-start-sql-from-shell-script.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090918/mysql-start-sql-from-shell-script.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

