<?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>MySQL How 2</title>
	<atom:link href="http://www.mysqlhow2.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlhow2.com</link>
	<description>MySQL DBA information and helpful tips and tricks to make life easier.</description>
	<lastBuildDate>Mon, 08 Mar 2010 20:33:47 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress Idea&#8217;s Password Suggestion</title>
		<link>http://www.mysqlhow2.com/2010/03/07/wordpress-ideas-password-suggestion/</link>
		<comments>http://www.mysqlhow2.com/2010/03/07/wordpress-ideas-password-suggestion/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 07:15:12 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=417</guid>
		<description><![CDATA[I was looking around Wordpress.org at idea&#8217;s, that the community was suggesting. I took the Password Suggestion idea and made a small change to 2 of the core scripts. This change will give the administrator of a blog the ability to randomly generate password for users they are adding or editing. This was a 5 [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>I was looking around Wordpress.org at idea&#8217;s, that the community was suggesting. I took the <a title="Password Suggestion" href="http://wordpress.org/extend/ideas/topic/password-suggestion" target="_blank">Password Suggestion</a> idea and made a small change to 2 of the core scripts. This change will give the administrator of a blog the ability to randomly generate password for users they are adding or editing. This was a 5 min project and you can see the changes below. I have also made it possible to see plain text passwords in the password fields. I don&#8217;t know if I am suppose to release stuff like this for Wordpress and I hope I have not offended anyone on the core development team.</p>

<a href='http://www.mysqlhow2.com/2010/03/07/wordpress-ideas-password-suggestion/snapshot1/' title='snapshot1'><img width="150" height="70" src="http://www.mysqlhow2.com/wp-content/uploads/2010/03/snapshot1-150x70.png" class="attachment-thumbnail" alt="" title="snapshot1" /></a>
<a href='http://www.mysqlhow2.com/2010/03/07/wordpress-ideas-password-suggestion/snapshot2/' title='snapshot2'><img width="150" height="65" src="http://www.mysqlhow2.com/wp-content/uploads/2010/03/snapshot2-150x65.png" class="attachment-thumbnail" alt="" title="snapshot2" /></a>
<a href='http://www.mysqlhow2.com/2010/03/07/wordpress-ideas-password-suggestion/snapshot3-2/' title='snapshot3'><img width="150" height="74" src="http://www.mysqlhow2.com/wp-content/uploads/2010/03/snapshot3-150x74.png" class="attachment-thumbnail" alt="" title="snapshot3" /></a>

<pre><strong>Add User</strong></pre>
<pre class="brush: jscript;">
&lt;pre&gt;&lt;?php if ( apply_filters('show_password_fields', true) ) : ?&gt;
        &lt;tr&gt;

        &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
        &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
        function passgen() {
         var chars = &quot;0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;*()&quot;;
         var string_length = 10;
         var passgen = '';
         for (var i=0; i&lt;string_length; i++) {
          var rnum = Math.floor(Math.random() * chars.length);
          passgen += chars.substring(rnum,rnum+1);
         }
         document.adduser.pass1.value = passgen;
         document.adduser.pass2.value = passgen;
        }

        &lt;/script&gt;
        &lt;!-- end add --&gt;

                &lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;pass1&quot;&gt;&lt;?php _e('Password'); ?&gt; &lt;span&gt;&lt;?php _e('(twice, required)'); ?&gt;&lt;/span&gt;&lt;/label&gt;&lt;/th&gt;
                &lt;td&gt;&lt;input name=&quot;pass1&quot; type=&quot;password&quot; id=&quot;pass1&quot; autocomplete=&quot;off&quot; /&gt;
                &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
                &lt;input type=&quot;button&quot; value=&quot;Generate Password&quot; onClick=&quot;passgen();&quot; /&gt;
                &lt;!-- end add --&gt;
                &lt;br /&gt;
                &lt;input name=&quot;pass2&quot; type=&quot;password&quot; id=&quot;pass2&quot; autocomplete=&quot;off&quot; /&gt;
                &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
                &lt;input type=&quot;checkbox&quot; onchange=&quot;document.getElementById('pass1').type = this.checked ? 'text' : 'password'; document.getElementById('pass2').type = this.checked ? 'text' : 'password'&quot; /&gt; Show passwords
                &lt;!-- end add --&gt;
                &lt;br /&gt;
                &lt;div id=&quot;pass-strength-result&quot;&gt;&lt;?php _e('Strength indicator'); ?&gt;&lt;/div&gt;
                &lt;p&gt;&lt;?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! &quot; ? $ % ^ &amp;amp; ).'); ?&gt;&lt;/p&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
&lt;/pre&gt;
</pre>
<p> <strong>Edit User</strong></p>
<pre class="brush: jscript;">
&lt;pre&gt;
$show_password_fields = apply_filters('show_password_fields', true, $profileuser);
if ( $show_password_fields ) :
?&gt;
&lt;tr id=&quot;password&quot;&gt;
&lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
        &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
        function passgen() {
         var chars = &quot;0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;*()&quot;;
         var string_length = 10;
         var passgen = '';
         for (var i=0; i&lt;string_length; i++) {
          var rnum = Math.floor(Math.random() * chars.length);
          passgen += chars.substring(rnum,rnum+1);
         }
         document.getElementById('pass1').value = passgen;
         document.getElementById('pass2').value = passgen;
        }

        &lt;/script&gt;
        &lt;!-- end add --&gt;

        &lt;th&gt;&lt;label for=&quot;pass1&quot;&gt;&lt;?php _e('New Password'); ?&gt;&lt;/label&gt;&lt;/th&gt;
        &lt;td&gt;&lt;input type=&quot;password&quot; name=&quot;pass1&quot; id=&quot;pass1&quot; size=&quot;16&quot; value=&quot;&quot; autocomplete=&quot;off&quot; /&gt;
                &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
                &lt;input type=&quot;button&quot; value=&quot;Generate Password&quot; onClick=&quot;passgen();&quot; /&gt;
                &lt;!-- end add --&gt;
                 &lt;span&gt;&lt;?php _e(&quot;If you would like to change the password type a new one. Otherwise leave this blank.&quot;); ?&gt;&lt;/span&gt;&lt;br /&gt;
                &lt;input type=&quot;password&quot; name=&quot;pass2&quot; id=&quot;pass2&quot; size=&quot;16&quot; value=&quot;&quot; autocomplete=&quot;off&quot; /&gt;
                &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
                &lt;input type=&quot;checkbox&quot; onchange=&quot;document.getElementById('pass1').type = this.checked ? 'text' : 'password'; document.getElementById('pass2').type = this.checked ? 'text' : 'password'&quot; /&gt; Show passwords
                &lt;!-- end add --&gt;
                &lt;span&gt;&lt;?php _e(&quot;Type your new password again.&quot;); ?&gt;&lt;/span&gt;&lt;br /&gt;

                &lt;div id=&quot;pass-strength-result&quot;&gt;&lt;?php _e('Strength indicator'); ?&gt;&lt;/div&gt;
                &lt;p&gt;&lt;?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! &quot; ? $ % ^ &amp;amp; ).'); ?&gt;&lt;/p&gt;
        &lt;/td&gt;
&lt;/tr&gt;
&lt;?php endif; ?&gt;
&lt;/pre&gt;
</pre>
<blockquote><p>
<strong>Installation is pretty easy</strong></p>
<p>But first I can not stress this enough as you will be changing core scripts. I am not responsible if it breaks your site.<br />
 <strong>BACKUP BACKUP BACKUP</strong></p>
<p><strong>Install by downloading the files</strong></p>
<ol>
<li>Download the fies <a href="http://www.mysqlhow2.com/wp-content/uploads/2010/03/new_user_scripts.tar.gz" target="_self">here</a>.</li>
<li>Backup user-new.php and user-edit.php located in /wp-admin.</li>
<li>Extract file in /wp-admin directory via ftp or scp.</li>
</ol>
<pre><strong>Install by changing the files</strong>
<ol>
<li> Open /wp-admin/user-new.php in your favorite editor (I use VIM)</li>
<li>Find "&lt;tr&gt;" around line 118</li>
<li>Add after &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
 &lt;script language="javascript" type="text/javascript"&gt;
 function passgen() {
 var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;*()";
 var string_length = 10;
 var passgen = '';
 for (var i=0; i&lt;string_length; i++) {
 var rnum = Math.floor(Math.random() * chars.length);
 passgen += chars.substring(rnum,rnum+1);
 }
 document.adduser.pass1.value = passgen;
 document.adduser.pass2.value = passgen;
 }

 &lt;/script&gt;
 &lt;!-- end add --&gt;</li>
<li>Find "&lt;input name="pass1" type="password" id="pass1" autocomplete="off" /&gt;" around line 138</li>
<li>Add after &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
 &lt;input type="button" value="Generate Password" onClick="passgen();" /&gt;
 &lt;!-- end add --&gt;</li>
<li>Find "&lt;input name="pass2" type="password" id="pass2" autocomplete="off" /&gt;"</li>
<li>Add after &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
 &lt;input type="checkbox" onchange="document.getElementById('pass1').type = this.checked ? 'text' : 'password'; document.getElementById('pass2').type = this.checked ? 'text' : 'password'" /&gt; Show passwords
 &lt;!-- end add --&gt;</li>
<li>Save file.</li>
<li>Open file /wp-admin/user-edit.php in your favorite editor (I use VIM)</li>
<li>Find "tr id="password"&gt;" around line 295</li>
<li>Add after &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
 &lt;script language="javascript" type="text/javascript"&gt;
 function passgen() {
 var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;*()";
 var string_length = 10;
 var passgen = '';
 for (var i=0; i&lt;string_length; i++) {
 var rnum = Math.floor(Math.random() * chars.length);
 passgen += chars.substring(rnum,rnum+1);
 }
 document.getElementById('pass1').value = passgen;
 document.getElementById('pass2').value = passgen;
 }
 &lt;/script&gt;
 &lt;!-- end add --&gt;</li>
<li>Find "&lt;input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /&gt;" around line 314</li>
<li>Add after
 &lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
 &lt;input type="button" value="Generate Password" onClick="passgen();" /&gt;
 &lt;!-- end add --&gt;</li>
<li>Find "&lt;input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /&gt;" around line 319</li>
<li>Add after
&lt;!-- Added By Lee Thompson of http://www.mysqlhow2.com --&gt;
 &lt;input type="checkbox" onchange="document.getElementById('pass1').type = this.checked ? 'text' : 'password'; document.getElementById('pass2').type = this.checked ? 'text' : 'password'" /&gt; Show passwords
 &lt;!-- end add --&gt;</li>
<li>Save File.</li>
</ol>
</pre>
</blockquote>
</pre>
<p><strong>Well I hope this helps the administrators that are looking for a random password generator, in the administration section for adding and editing users.</strong></p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/03/07/wordpress-ideas-password-suggestion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Plugin Stats</title>
		<link>http://www.mysqlhow2.com/2010/02/23/my-plugin-stats/</link>
		<comments>http://www.mysqlhow2.com/2010/02/23/my-plugin-stats/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:13:05 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=372</guid>
		<description><![CDATA[Wordpress plugin that monitors you custom plugin downloads or even plugins you like]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>Description:<br />
My Plugin Stats, will show the download stats of your custom plugins. It pull the information from wordpress.org. It creates a dashboard widget and you can monitor many plugins at once. You can add and remove as many plugins as you like.</p>
<p>Some of the features:</p>
<ul>
<li> Add Plugins you want to watch stats on.</li>
<li> Fully intergrated dashboard widget.</li>
<li> Compatible with all versions Wordpress</li>
<li> Will work with any caching system.</li>
</ul>
<p>If you have any problems with the plugins, please visit [http://mysqlhow2.com/] for further information and provide some feedback first, we may be able to help. It&#8217;s considered rude to just give low ratings and nothing reason for doing so.</p>
<p>If you find this plugin useful and would like to say thanks, a link, digg, or some other form of recognition to the plugin page on our blog would be appreciated.</p>
<p>Installation:</p>
<p>1. Donwload the ZIP file <a title="Plugin Stats" href="http://downloads.wordpress.org/plugin/my-plugin-stats.zip">My Plugin Stats </a>and upload it to your plugins directory and unzip.<br />
2. Activate plugin in your administration section.<br />
3. Place widget in your sidebar.<br />
4. Select the woots you want to watch in the administration section.</p>
<p>FAQ:<br />
None</p>
<p>Screen Shots:</p>

<a href='http://www.mysqlhow2.com/2010/02/23/my-plugin-stats/screenshot-1-2/' title='screenshot-1'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/screenshot-11-150x150.png" class="attachment-thumbnail" alt="" title="screenshot-1" /></a>
<a href='http://www.mysqlhow2.com/2010/02/23/my-plugin-stats/screenshot-2-2/' title='screenshot-2'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/screenshot-21-150x150.png" class="attachment-thumbnail" alt="" title="screenshot-2" /></a>

<p>Changelog:<br />
1.0<br />
Inital release</p>
<div class="wrap">Donations are accepted for continued development of My Plugin Stats. Thank you.</p>
<p><script type="text/javascript">// <![CDATA[
         document.write(unescape("%3Ca%20href%20%3D%20%22https%3A//www.paypal.com/cgi-bin/webscr%3Fcmd%3D_s-xclick%26hosted_button_id%3D25LDNVSUTHKAJ%22%20target%20%3D%20%22_blank%22%3E%3Cimg%20src%3D%22https%3A//www.paypal.com/en_US/i/btn/btn_donate_SM.gif%22%20border%3D%220%22%20name%3D%22submit%22%20alt%3D%22PayPal%20-%20The%20safer%2C%20easier%20way%20to%20pay%20online%21%22%3E%3C/a%3E%0A"));
// ]]&gt;</script></p>
</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/23/my-plugin-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disk Raid Levels</title>
		<link>http://www.mysqlhow2.com/2010/02/20/disk-raid-levels/</link>
		<comments>http://www.mysqlhow2.com/2010/02/20/disk-raid-levels/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 17:07:16 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[redundancy]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=363</guid>
		<description><![CDATA[This article talks about raid levels and how they work. I like to use raid 5 and raid 10, this is based on performance testing that reads are faster on raid 5 and writes are faster on raid 10. I will be posting benchmark results soon so that you can see the differences of raid [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>This article talks about raid levels and how they work. I like to use raid 5 and raid 10, this is based on performance testing that reads are faster on raid 5 and writes are faster on raid 10. I will be posting benchmark results soon so that you can see the differences of raid levels.</p>
<p><strong>RAID 1</strong><br />
RAID 1 mirrors the contents of the disks, making a form of 1:1 ratio realtime backup. The contents of each disk in the array are identical to that of every other disk in the array. A RAID 1 array requires a minimum of two drives. Although RAID 1&#8217;s writing process copies the data identically to all drives, a RAID 1 mirror would not be suitable as a permanent backup solution for businesses, since RAID architecture by design allows for certain failures to take place (e.g. vandalism or accidental file deletion). However for home or other applications, where vandalism is very unlikely and accidental file deletion is put up with, RAID 1 offers a good backup solution.<br />
<strong></strong></p>
<p><strong>RAID 3/4</strong><br />
RAID 3 or 4 (striped disks with dedicated parity) combines three or more disks in a way that protects data against loss of any one disk. Fault tolerance is achieved by adding an extra disk to the array, which is dedicated to storing parity information; the overall capacity of the array is reduced by one disk. A RAID 3 or 4 array requires a minimum of three drives: two to hold striped data, and a third for parity. With the minimum three drives needed for RAID 3, the storage efficiency is 66 percent. With six drives, the storage efficiency is 87 percent. The main disadvantage is poor performance for multiple, simultaneous, and independent read/write operations.<br />
<strong></strong></p>
<p><strong>RAID 5</strong><br />
Striped set with distributed parity or interleave parity requiring 3 or more disks. Distributed parity requires all drives but one to be present to operate; drive failure requires replacement, but the array is not destroyed by a single drive failure. Upon drive failure, any subsequent reads can be calculated from the distributed parity such that the drive failure is masked from the end user. The array will have data loss in the event of a second drive failure and is vulnerable until the data that was on the failed drive is rebuilt onto a replacement drive. A single drive failure in the set will result in reduced performance of the entire set until the failed drive has been replaced and rebuilt.<br />
<strong>RAID 6</strong><br />
RAID 6 (striped disks with dual parity) combines four or more disks in a way that protects data against loss of any two disks.<br />
<strong>RAID 10</strong><br />
RAID 1+0 (or 10) is a mirrored data set (RAID 1) which is then striped (RAID 0), hence the &#8220;1+0&#8243; name. A RAID 1+0 array requires a minimum of four drives: two mirrored drives to hold half of the striped data, plus another two mirrored for the other half of the data. In Linux MD RAID 10 is a non-nested RAID type like RAID 1, that only requires a minimum of two drives, and may give read performance on the level of RAID 0.<br />
<strong></strong></p>
<p><strong>RAID 01</strong><br />
RAID 0+1 (or 01) is a striped data set (RAID 0) which is then mirrored (RAID 1). A RAID 0+1 array requires a minimum of four drives: two to hold the striped data, plus another two to mirror the first pair.</p>
<p>RAID can involve significant computation when reading and writing information. With traditional &#8220;real&#8221; RAID hardware, a separate controller does this computation. In other cases the operating system or simpler and less expensive controllers require the host computer&#8217;s processor to do the computing, which reduces the computer&#8217;s performance on processor-intensive tasks (see Operating system based (&#8220;software RAID&#8221;) and Firmware/driver-based RAID below). Simpler RAID controllers may provide only levels 0 and 1, which require less processing.<br />
RAID systems with redundancy continue working without interruption when one (or possibly more, depending on the type of RAID) disks of the array fail, although they are then vulnerable to further failures. When the bad disk is replaced by a new one the array is rebuilt while the system continues to operate normally. Some systems have to be powered down when removing or adding a drive; others support hot swapping, allowing drives to be replaced without powering down. RAID with hot-swapping is often used in high availability systems, where it is important that the system remains running as much of the time as possible.<br />
Note that a RAID controller itself can become the single point of failure within a system.</p>
<p>We will talk about nested raid levels in the upcoming days as I start to benchmark for which ones have better performance with out risk</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/20/disk-raid-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Memory Settings</title>
		<link>http://www.mysqlhow2.com/2010/02/19/mysql-memory-settings/</link>
		<comments>http://www.mysqlhow2.com/2010/02/19/mysql-memory-settings/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 16:00:38 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=356</guid>
		<description><![CDATA[These are some settings values I look at when I start up a new MySQL instance. Not all instances of MySQL will have the same, so I tweak until I get optimal performance out of MySQL. Also remember not to go into swap when allocating memory.]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>These are some settings values I look at when I start up a new MySQL instance. Not all instances of MySQL will have the same, so I tweak until I get optimal performance out of MySQL. Also remember not to go into swap when allocating memory.</p>
<p><strong>General MySQL Settings</strong><br />
The Most important ones are:<br />
<strong>Key Buffer</strong><br />
The key buffer holds the indexes of tables in memory and a bigger key buffer results in faster row lookups. Adjust according to your own needs. Bigger is better, but prevent swapping at all costs. A good rule of thumb seems to be to use 1/4 of system memory.</p>
<p><strong>Query Cache</strong><br />
This is where the magic happens. Well, not magic really, just plain old caching. Keeping the result of queries in memory until they are invalidated by additional writes enhances performance by magnitudes. The query_cache_size, as the name suggests, is the total size of memory available to query caching. The value query_cache_limit is the maximum number of kilobytes one query may be in order to be cached. Setting this value too high might prevent a lot of smaller queries to be cached. Setting it too low will result in bigger queries to never be cached, and the smaller queries not being able to completely fill the cache size, which would be a waste of resources. Adjust according to your own needs and memory available:</p>
<p><strong>Table Cache</strong><br />
An important variable if your application accesses many tables. It is the number of tables a thread can keep open at the same time. A value of 512 should do no harm.</p>
<p><strong>Sort Buffers</strong><br />
sort_buffer_size (the variable previously known as sort_buffer), used for grouping and sorting and is a per-thread buffer. If the buffer can not hold the data to be sorted, a sort is performed on disk. Watch out for making this too large as the buffer is allocated for every thread that needs sorting and with many sorts it can easily consume all your memory.</p>
<p><strong>Binary Logging</strong><br />
MySQL has a few powerful features. Replicating data changes to a second server is one of them. MySQL keeps a log file of data changes which is used for this purpose. If you do not use replication or use the file as incremental backup, you can disable it. This will save you expensive disk write actions for every change to your data. For applications that have a lot of frequently updated data, this can be quite a performance boost. According to the official docs, this will generally result in just a 1% boost but it’s an easy gain if you do not need the log. Read more about the binary log here. Comment the following line:<br />
log-bin = /var/log/mysql/mysql-bin.log</p>
<p><strong>Temporary Tables</strong><br />
Temporary tables are used for sorting and grouping. The buffer is created on demand so watch out for setting this too high here as well. If the buffer cannot accomodate the data, a temp file is used on disk instead.</p>
<p><strong>Delayed Writing</strong><br />
This setting can greatly improve writing or updating data to a table. Instead of directly committing data to the disk, MySQL queues writes and returns write queries immediately. Be very very careful with this, because this also means that in case of a power failure or crash, you lose data. You can use this for logging if you don’t mind losing a couple of rows in case of a crash.</p>
<p><strong>Connection Timeout</strong><br />
This is a little tweak that determines the closing of sleeping connections. The default is one hour and is often too long for practical purposes. I often set this at one minute instead (60).<br />
wait_timeout = 60<br />
The above settings are just to make mysql a little faster in general. You can get much better speed improvements by optimizing the database itself. Setting the correct indexes on tables can be a life-saver.</p>
<p><strong>MySQL Innodb Settings</strong><br />
The most important ones are:</p>
<p><strong>innodb_buffer_pool_size</strong><br />
70-80% of memory is a safe bet. I set it to 12G on 16GB box.</p>
<p><strong>innodb_log_file_size</strong><br />
This depends on your recovery speed needs but 256M seems to be a good balance between reasonable recovery time and good performance</p>
<p><strong>innodb_log_buffer_size=4M</strong><br />
4M is good for most cases unless you’re piping large blobs to Innodb in this case increase it a bit.</p>
<p><strong>innodb_flush_log_at_trx_commit=2</strong><br />
If you’re not concern about ACID and can loose transactions for last second or two in case of full OS crash than set this value. It can dramatic effect especially on a lot of short write transactions.</p>
<p><strong>innodb_thread_concurrency=8</strong><br />
Even with current Innodb Scalability Fixes having limited concurrency helps. The actual number may be higher or lower depending on your application and default which is 8 is decent start</p>
<p><strong>innodb_flush_method=O_DIRECT</strong><br />
Avoid double buffering and reduce swap pressure, in most cases this setting improves performance. Though be careful if you do not have battery backed up RAID cache as when write IO may suffer.</p>
<p><strong>innodb_file_per_table</strong><br />
If you do not have too many tables use this option, so you will not have uncontrolled innodb main tablespace growth which you can’t reclaim. This option was added in MySQL 4.1 and now stable enough to use.</p>
<p>Also check if your application can run in READ-COMMITED isolation mode – if it does – set it to be default as transaction-isolation=READ-COMMITTED. This option has some performance benefits, especially in locking in 5.0 and even more to come with MySQL 5.1 and row level replication.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/19/mysql-memory-settings/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wordpress Woot Watcher</title>
		<link>http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/</link>
		<comments>http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 04:37:14 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[watcher]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[woot]]></category>
		<category><![CDATA[woot off]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=324</guid>
		<description><![CDATA[2-17-2008 TODAY Wordpress.org posted woot watcher!!!!!!!!!!!! Check it out here Woot Watcher
Description:
Wordpress Woot Watcher, will monitor and check woot, shirt woot, kids woot, wine woot and sellout for new products every 10 hours. When a woot-off is launched it updates the woot product every 30 seconds, to increae your chance for a bag of crap [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p><span style="text-decoration: underline;"><em><strong>2-17-2008 TODAY Wordpress.org posted woot watcher!!!!!!!!!!!! Check it out here <a title="Woot Watcher" href="http://wordpress.org/extend/plugins/wordpress-woot-watcher/" target="_blank">Woot Watcher</a></strong></em></span></p>
<p><strong>Description:</strong><br />
Wordpress Woot Watcher, will monitor and check woot, shirt woot, kids woot, wine woot and sellout for new products every 10 hours. When a woot-off is launched it updates the woot product every 30 seconds, to increae your chance for a bag of crap or something you want cheap. Wordpress Woot Watcher is a sidear widget, where you can select the woot sites you want to monitor in the administration  section. The default installation selects woot.com. This widget was built by Lee Thompson of MySQLHOW2.com and Mark Stoecker of POUNDBANGWHACK.com. We have been testing and found this to be stable to release to the community.</p>
<p><strong>Installation:</strong></p>
<blockquote>
<ol>
<li>Donwload the ZIP file <a href="http://www.mysqlhow2.com/wp-content/uploads/2010/02/wpwootwatcher1.zip">Wordpress Woot Watcher</a> and upload it to your plugins directory and unzip.</li>
<li>Activate plugin in your administration section.</li>
<li>Place widget in your sidebar.</li>
<li>Select the woots you want to watch in the administration section.</li>
</ol>
</blockquote>
<p><strong>FAQ:</strong><br />
Can I use light boxes<br />
Yes, it works with <a title="Jquery Lightbox" href="http://wordpress.org/extend/plugins/jquery-lightbox-balupton-edition/" target="_blank">jquery lightbox</a> or <a title="Lightbox 2" href="http://wordpress.org/extend/plugins/lightbox-2/" target="_blank">lightbox 2</a>.</p>
<p><strong>Screen Shots:</strong><br />

<a href='http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/snapshot3/' title='snapshot3'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/snapshot3-150x150.png" class="attachment-thumbnail" alt="" title="snapshot3" /></a>
<a href='http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/snapshot4/' title='snapshot4'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/snapshot4-150x150.png" class="attachment-thumbnail" alt="" title="snapshot4" /></a>
<a href='http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/snapshot5/' title='snapshot5'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/snapshot5-150x150.png" class="attachment-thumbnail" alt="" title="snapshot5" /></a>
<a href='http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/snapshot6/' title='Administration Panel'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/snapshot6-150x150.png" class="attachment-thumbnail" alt="Woot Watcher Administration Panel" title="Administration Panel" /></a>
<a href='http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/snapshot7/' title='Woot Off'><img width="150" height="150" src="http://www.mysqlhow2.com/wp-content/uploads/2010/02/snapshot7-150x150.png" class="attachment-thumbnail" alt="Sample Woot Off" title="Woot Off" /></a>
</p>
<p><img title="gallery link=&quot;file&quot;" src="http://www.mysqlhow2.com/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif" alt="" /></p>
<p><strong>Changelog:</strong><br />
1.1<br />
Inital release</p>
<p>Please donate for continued development.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="25LDNVSUTHKAJ" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/16/wordpress-woot-watcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Help to make your database and wordpress secure</title>
		<link>http://www.mysqlhow2.com/2010/02/09/help-to-make-your-database-and-website-secure/</link>
		<comments>http://www.mysqlhow2.com/2010/02/09/help-to-make-your-database-and-website-secure/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 04:47:12 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=315</guid>
		<description><![CDATA[Every now and then you see a site that has been hacked due to lack of security. I make it a practice to update my pass and secure my configuration files in a directory out of www/. I change my passwords every 60days on the database and on my account in wordpress, I use random [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>Every now and then you see a site that has been hacked due to lack of security. I make it a practice to update my pass and secure my configuration files in a directory out of www/. I change my passwords every 60days on the database and on my account in wordpress, I use random generated passwords to provide a little extra security. Im not saying this will prevent my site from being hacked, but it helps.</p>
<p>Every 60 days I add a user on the database that has the only needed privileges for the application to run. I show the current privileges and change user and password and add the new user. I record the old one in case I need to fail back. I also have changed the default user &#8220;root&#8221; to  another username, and I have deleted the testdb that is installed when you setup mysql initially.</p>
<p>I use the CLI to do all my mysql work but you can easily do this yourself using phpmyadmin, make sure the user you make the changes with has GRANT OPTION.</p>
<p>1)<strong> SHOW GRANTS FOR &#8216;&lt;username&gt; &#8216;@&#8217;&lt;host&gt;&#8217;;</strong></p>
<p><em>GRANT USAGE ON *.* TO &#8216;olduser&#8217;@'%&#8217; IDENTIFIED BY PASSWORD &#8216;*BCF0C51505BF07C0AC46B9AEBB7F9726EB4677B8&#8242;;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;olduser&#8217;@'localhost&#8217;;</em></p>
<p>2) Now you need to change the use and password from GRANT. You have 4 otptions for setting password by calling the password function or by using plain text. Using plain text will put the plain text in the binary log!!!</p>
<p><strong>Option A:</strong> Generate the password hash using mysql</p>
<p><strong>SELECT PASSWORD(&#8217;somepassword&#8217;);</strong></p>
<p>this will out put<br />
<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| password(&#8217;somepassword&#8217;)                  |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| *DAABDB4081CCE333168409A6DB119E18D8EAA073 |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</strong><br />
<strong>1 row in set (0.00 sec)</strong><br />
Now that we have the has of the password &#8220;somepassword&#8221; we can use that to update the password when applying grants.</p>
<p><em>GRANT USAGE ON *.* TO &#8216;newuser&#8217;@'%&#8217; IDENTIFIED BY PASSWORD &#8216;*DAABDB4081CCE333168409A6DB119E18D8EAA073&#8242;;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;newuser&#8217;@'localhost&#8217;;</em></p>
<p><strong>Option B:</strong> You can use the password function to update the password during grant option.</p>
<p><em>GRANT USAGE ON *.* TO &#8216;newuser&#8217;@'%&#8217; IDENTIFIED BY PASSWORD(&#8217;somepassword&#8217;);<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;newuser&#8217;@'localhost&#8217;;</em></p>
<p><strong>Option C: </strong>You can set the password by removing the password from the old grant.</p>
<p><em>GRANT USAGE ON *.* TO &#8216;newuser&#8217;@'%&#8217; IDENTIFIED BY &#8217;somepassword&#8217;;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;newuser&#8217;@'localhost&#8217;;</em></p>
<p><strong>Option D:</strong> I do not reccomend this as it is not a proper way to update grants for a user, but you can update the mysql.user table to change the user and passwords.</p>
<p><em>UPDATE mysql.user set user = &#8216;newuser&#8217;, password = PASSWORD(&#8216;newpassword&#8217;) where user = &#8216;olduser&#8217;;</em></p>
<p>This is not a proper way of updateing user but you can use it as long as you have rights to the mysql database.</p>
<p>The next step for any of these changes is to FLUSH PRIVILEGES: This flushes the new user to disk and refreshes the memory.</p>
<p>The final step will be to update the wp-config.php file in your www directory. In your www directory open your wp-config.php file with a text editor I use VIM for mine and look for these lines:<br />
<strong>/** MySQL database username */<br />
define(&#8216;DB_USER&#8217;, &#8216;olduser&#8217;);<br />
/** MySQL database password */<br />
define(&#8216;DB_PASSWORD&#8217;, &#8216;oldpassword&#8217;);</strong><br />
Update the user and password with your new information.</p>
<p>To try to secure my website I have changed my wp-config.php adn took the above lines out and put them in a seperate file and moved it to a directory outside of the www directory. I have my own server so I can put it anywhere as long as I know the absolute path. I have also encrypted the file using gpg which I will talk about in the near future. Once I make all the password and user updates I remove the old user from mysql and flush privileges once again.</p>
<p>Hopefully this article will help those who want to try to secure their site more effeciently. Please let me know if you have any questions or suggestions to secure a site.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/09/help-to-make-your-database-and-website-secure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Having is not a replacement for a where clause!</title>
		<link>http://www.mysqlhow2.com/2010/02/06/having-is-not-a-replacement-for-a-where-clause/</link>
		<comments>http://www.mysqlhow2.com/2010/02/06/having-is-not-a-replacement-for-a-where-clause/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 10:00:34 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Formulas]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[having]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[where]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=229</guid>
		<description><![CDATA[Even a query that is checking against an good index will result in a table scan if it is poorly written.  It seems some people think that HAVING can be a substitute for WHERE.  For example:

SELECT word_id
FROM forum.wordmatch
GROUP BY word_id
HAVING COUNT( word_id ) =53805;

This seems pretty straightforward; the query is trying to display how many [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>Even a query that is checking against an good index will result in a table scan if it is poorly written.  It seems some people think that HAVING can be a substitute for WHERE.  For example:</p>
<pre class="brush: sql;">
SELECT word_id
FROM forum.wordmatch
GROUP BY word_id
HAVING COUNT( word_id ) =53805;
</pre>
<p>This seems pretty straightforward; the query is trying to display how many entries have a word_id (indexed) greater than 53805.  But an explain shows that this is a table scan:</p>
<pre class="brush: plain;">
| table | type | possible_keys | key | key_len | ref | rows | Extra |
| wordmatch | index | NULL | word_id | 3 | NULL | 6374529 | Using index |
</pre>
<p>The problem is there is no WHERE clause, and HAVING just controls output.  So rewriting the query like so improves the performance by a factor of 10:</p>
<pre class="brush: sql;">
SELECT count( word_id )
FROM forum.wordmatch
WHERE word_id =53805;
</pre>
<pre class="brush: plain;">
| table | type | possible_keys | key | key_len | ref | rows | Extra |
| wordmatch | range | word_id | word_id | 3 | NULL | 641340 | Using where; Using index |
</pre>
<p>To quote mysql.com:</p>
<p>&#8220;Do not use HAVING for items that should be in the WHERE clause&#8221;. For example, do not write the following:</p>
<pre class="brush: sql;">
SELECT col_name FROM tbl_name HAVING col_name = 0;
</pre>
<p>Write this instead:</p>
<pre class="brush: sql;">
SELECT col_name FROM tbl_name WHERE col_name = 0;
</pre>
<p>The HAVING clause can refer to aggregate functions, which the WHERE clause cannot:</p>
<pre class="brush: sql;">
SELECT user, MAX(salary) FROM users
GROUP BY user HAVING MAX(salary) ;
</pre>
<pre class="brush: sql;">
SELECT DISTINCT ac2.category, ac0.name
FROM snaggy.a2_category ac1, snaggy.a2_category ac2, snaggy.a2_catalog ac0
WHERE ac1.category = 'GAME'
AND ac2.vendor_code = ac1.vendor_code
AND ac2.item_id = ac1.item_id
AND ac0.category = ac2.category
ORDER BY ac0.name
</pre>
<pre class="brush: plain;">
| table | type | possible_keys | key | key_len | ref | rows | Extra |
| ac0 | ALL | NULL | NULL | NULL | NULL | 145 |
| ac1 | ALL | category | NULL | NULL | NULL | 2886 | Using where; Using temporary; Using filesort
| ac2 | ALL | category | NULL | NULL | NULL |2886 | Using where |
</pre>
<pre class="brush: sql;">
CREATE TABLE `a2_category` (
`vendor_code` varchar(4) default NULL,
`item_id` int(5) default NULL,
`category` varchar(8) default NULL,
FULLTEXT KEY `category` (`category`)
) TYPE=MyISAM
</pre>
<p>Just adding an index helps makes the same query complete in a realistic timeframe:</p>
<pre class="brush: sql;">
ALTER TABLE a2_category ADD INDEX (item_id);
</pre>
<pre class="brush: plain;">
| table | type | possible_keys | key | key_len | ref | rows | Extra |
| ac0 | ALL | NULL | NULL | NULL | NULL | 145 | Using where |
| ac1 | ALL | item_id,category | NULL | NULL | NULL | 2886 | Using where; Using temporary; Using filesort |
| ac2 | ref | item_id,category | item_id | 5 | ac1.item_id | 3 | Using where |
</pre>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/06/having-is-not-a-replacement-for-a-where-clause/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Regular Expressions</title>
		<link>http://www.mysqlhow2.com/2010/02/05/mysql-reg-expressions/</link>
		<comments>http://www.mysqlhow2.com/2010/02/05/mysql-reg-expressions/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 19:15:37 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Formulas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Regular expressions]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=237</guid>
		<description><![CDATA[I added a page with a reg expression cheat sheet, so I wanted to post how MySQL can use reg expressions in select queries. I use these and they can be powerful. Using reg expressions in selects is about as basic as it comes.
The format for reg expression for a SELECT is:

SELECT something FROM table [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>I added a page with a<a title="reg expression" href="http://www.mysqlhow2.com/reg-expression-cheat-sheet/"> reg expression cheat</a> sheet, so I wanted to post how MySQL can use reg expressions in select queries. I use these and they can be powerful. Using reg expressions in selects is about as basic as it comes.</p>
<p>The format for reg expression for a SELECT is:</p>
<pre class="brush: sql;">
SELECT something FROM table WHERE column REGEXP 'regexp'
</pre>
<p>For example, to select all columns from the table events where the values in the column id end with 5309, use:</p>
<pre class="brush: sql;">
SELECT * FROM events WHERE id REGEXP '5309$'
</pre>
<p>A more elaborate example selects all columns of the table reviews where the values in the column description contain the word &#8220;mysql&#8221;:</p>
<pre class="brush: sql;">
SELECT * FROM reviews WHERE description REGEXP '[[:&lt;:]]mysql[[:&gt;:]]'
</pre>
<p>MySQL allows the following regular expression metacharacters:. match any character</p>
<ul>
<li> ? match zero or one</li>
<li> * match zero or more</li>
<li> + match one or more</li>
<li> {n} match n times</li>
<li> {m,n} match m through n times</li>
<li> {n,} match n or more times</li>
<li> ^ beginning of line</li>
<li> $ end of line</li>
<li> [[:&lt;:]] match beginning of words [[:&gt;:]] match ending of words</li>
<li> [:class:] match a character class</li>
<li> i.e., [:alpha:] for letters</li>
<li> [:space:] for whitespace</li>
<li> [:punct:] for punctuation</li>
<li> [:upper:] for upper case letters</li>
<li> [abc] match one of enclosed chars</li>
<li> [^xyz] match any char not enclosed</li>
<li> | separates alternatives</li>
</ul>
<p>MySQL interprets a backslash (\) character as an escape character. To use a backslash in a regular expression, you must escape it with another backslash (\\).</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/05/mysql-reg-expressions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why is the dev.mysql.com link so important?</title>
		<link>http://www.mysqlhow2.com/2010/02/04/why-is-the-dev-mysql-com-link-so-important/</link>
		<comments>http://www.mysqlhow2.com/2010/02/04/why-is-the-dev-mysql-com-link-so-important/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 19:58:50 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[dev.mysql.com]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=219</guid>
		<description><![CDATA[What is a link?
A link is a reference on a web page that references some other place on the same page or somewhere else on the Internet. If text is &#8220;clickable&#8221; that means it is a hyperlink. You can identify a hyperlink in a number of ways but the easiest way is to move your [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>What is a link?</p>
<p>A link is a reference on a web page that references some other place on the same page or somewhere else on the Internet. If text is &#8220;clickable&#8221; that means it is a hyperlink. You can identify a hyperlink in a number of ways but the easiest way is to move your mouse pointer over the top of a picture or word and if your mouse cursor change to look like a small hand then the item you are looking at, is a link and you can click it.</p>
<p>Yes links are great, but if you are a regular user you most likely have it bookmarked or in your cache. I understand the re-organization of MySQL.com and this is something we all have to accept, with ORACLE being the new owners. We went through similar changes with SUN, like the certified candidates list. We complained, they did nothing and we accepted it. ORACLE is going to make changes whether the community likes it or not. We still know where to go to get to <a href="http://dev.mysql.com" target="_blank">dev.mysql.com</a> or <a title="MySQL org" href="http://mysql.org">MySQL.org</a></p>
<p>I&#8217;m actually providing a link in my blog-roll for those who need a link. I do suggest that we all make comments to <a title="ORACLE" href="http://www.oracle.com/us/corporate/contact/index.htm" target="_blank">ORACLE</a> asking them to provide the tools we need to be successful DBA&#8217;s or Developers. We also need to make sure we watch out for bigger changes like, no more support for community releases or stop development on MySQL.</p>
<p>As a community we still can provide each other support with sites like:</p>
<ul>
<li><a href="http://www.mysqlperformanceblog.com" target="_blank">MySQL Performance Blog</a></li>
<li><a href="http://http://www.xaprb.com/blog/" target="_blank">XAPRB</a></li>
<li><a href="http://mysqlha.blogspot.com//" target="_blank">High Availability MySQL</a></li>
<li><a href="http://planet.mysql.com/" target="_blank">Planet MySQL</a></li>
</ul>
<p>Sorry for the ones I forgot as this list can go ON and ON If you want me to add to my blog roll let me and I will. I also apologize for defending ORACLE but give them a chance, they &#8220;might do good things&#8221;. We know some of the changes will be bad but, maybe not all? Who knows.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/04/why-is-the-dev-mysql-com-link-so-important/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Rotate Tables C program</title>
		<link>http://www.mysqlhow2.com/2010/02/02/mysql-rotate-tables-c-program/</link>
		<comments>http://www.mysqlhow2.com/2010/02/02/mysql-rotate-tables-c-program/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:24:56 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[C Programs]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[rotate]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=209</guid>
		<description><![CDATA[I have written a little c program that will rotate tables and keep older tables for specified time. I use this program in a few environments where we have data retention requirements. This is to allow the tables not to grow absurdly large. This is my first C program please leave me feedback thank you.
USAGE:
Set [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>I have written a little c program that will rotate tables and keep older tables for specified time. I use this program in a few environments where we have data retention requirements. This is to allow the tables not to grow absurdly large. This is my first C program please leave me feedback thank you.</p>
<pre>USAGE:
Set up cron job to call the script once a week passing 3 variables
  1. Weeks to keep older tables
  2. Database Name
  3. Table Name
0 0 * * 0 /bin/lt_rotate_tables 3 testdb testing
</pre>
<pre class="brush: cpp;">

// This code written by Lee Thompson with debugging by Dave Allmon//
// This program will rotate definded table and keep backup tables for n ammount of weeks //
// The inital table must exist first!! //
// to compile **** gcc lt_rotate_tables.c -o lt_rotate_tables  `mysql_config --cflags --libs` ***//
// Cron ***  *** //

#include &lt;time.h&gt;
#include &lt;my_global.h&gt;
#include &lt;mysql.h&gt;

#define ONE_WEEK (86400 * 7)

// This code will create a new backup and delete the backup that is n weeks old.
// Ex: This is week 21. Running this code with weeks=4 will create a table_21 table and delete a writes_17 table.

char tableNameNew[64];
char tableNameDrop[64];
char tmpTable[64];
char tmpDBname[64];

// Creates two suffixes based on the week of the year:
//  1. This week for new backup.
//  2. (weeks) ago to be deleted.

void CreateTargetDateStrs( int weeks )
{
  time_t thisTime;
  struct tm * lt;

  memset( tableNameNew, 0, sizeof ( tableNameNew ));
  memset( tableNameDrop, 0, sizeof ( tableNameDrop ));

  thisTime = time( NULL );
  lt = localtime( &amp;thisTime );
  strftime(( char * ) &amp; tableNameNew, sizeof ( tableNameNew ), &quot;%B_%d&quot;, lt );

  thisTime -= ( ONE_WEEK * weeks );
  lt = localtime( &amp;thisTime );
  strftime(( char * ) &amp; tableNameDrop, sizeof ( tableNameDrop ), &quot;%B_%d&quot;, lt );
}

int main(int argc, char **argv)
{
  char tmpStr[256];
  MYSQL *conn;

  if ( argc == 4 )
  {
    CreateTargetDateStrs( atoi( argv[1] ));
    sprintf(tmpTable,(argv[3]));
    sprintf(tmpDBname,(argv[2]));
  }
  else
  {
    printf( &quot;\nUsage: ./lt_rotate_tables &lt;weeks&gt; &lt;database name&gt; &lt;table name&gt;\n&quot; );
    exit( 1 );
  }
  conn = mysql_init(NULL);
  /////////////// Make only change here ////////////////////////
  //Set connection here change &lt;user_name&gt;  &lt;password&gt;
  mysql_real_connect(conn, &quot;localhost&quot;, &quot;&lt;user_name&gt;&quot;, &quot;&lt;password&gt;&quot;, tmpDBname, 0, NULL, 0);

  // Drop oldest saved table.
  sprintf( tmpStr, &quot;DROP TABLE %s_%s&quot;, tmpTable, tableNameDrop );
  mysql_query(conn, tmpStr );

  // Rename current table to new name.
  sprintf( tmpStr, &quot;RENAME TABLE %s to %s_%s&quot;,tmpTable, tmpTable, tableNameNew );
  mysql_query(conn, tmpStr );

  // Create a new table like the last table.
  sprintf( tmpStr, &quot;CREATE TABLE %s like %s_%s&quot;, tmpTable, tmpTable, tableNameNew );
  mysql_query(conn, tmpStr );

  mysql_close(conn);
}
</pre>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/02/mysql-rotate-tables-c-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->