<?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>kieranbarnes &#187; MySQL</title>
	<atom:link href="http://bloke.org/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://bloke.org</link>
	<description>do you know where your towel is?</description>
	<lastBuildDate>Sat, 21 Aug 2010 12:03:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>cPanel MySQL Tuning</title>
		<link>http://bloke.org/linux/cpanel-mysql-tuning/</link>
		<comments>http://bloke.org/linux/cpanel-mysql-tuning/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 07:24:50 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[cPanel/WHM]]></category>

		<guid isPermaLink="false">http://bloke.org/?p=795</guid>
		<description><![CDATA[The default configuration for MySQL provided by cPanel is pretty barren. /etc/my.cnf
Thats it. One line. Its rubbish.
Here's mine to help you along the way. Its got some decent logging set, some decent cache and memory options for a shared server set and some helpful security settings enabled.


Related posts:MySQL Tuning Server Parameters These are some of [...]


Related posts:<ol><li><a href='http://bloke.org/linux/mysql-tuning-server-parameters/' rel='bookmark' title='Permanent Link: MySQL Tuning Server Parameters'>MySQL Tuning Server Parameters</a> <small>These are some of the handy MySQL 5.0 tweaks I...</small></li>
<li><a href='http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/' rel='bookmark' title='Permanent Link: [Snippet] Allow mysql root access from anywhere'>[Snippet] Allow mysql root access from anywhere</a> <small>A small annoyance of mine is on local development servers,...</small></li>
<li><a href='http://bloke.org/linux/installing-mytop-on-cpanel/' rel='bookmark' title='Permanent Link: Installing mytop on cpanel'>Installing mytop on cpanel</a> <small> MyTop is one of the best MySQL monitoring tools...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The default configuration for MySQL provided by cPanel is pretty barren. /etc/my.cnf</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="br0">&#91;</span>mysqld<span class="br0">&#93;</span> skip-innodb</pre></div></div>
<p>Thats it. One line. Its rubbish.</p>
<p>Here's mine to help you along the way. Its got some decent logging set, some decent cache and memory options for a shared server set and some helpful security settings enabled.</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="br0">&#91;</span>mysqld<span class="br0">&#93;</span>
max_connections = <span class="nu0">200</span>
bind-address = 127.0.0.1
&nbsp;
safe-show-database
skip-locking
skip-innodb
&nbsp;
<span class="co0"># MySQL 4.x has query caching available.</span>
<span class="co0"># Enable it for vast improvement and it may be all you need to tweak.</span>
<span class="re2">query_cache_type</span>=1
<span class="re2">query_cache_limit</span>=1M
<span class="re2">query_cache_size</span>=32M
&nbsp;
<span class="re2">interactive_timeout</span>=<span class="nu0">100</span>
&nbsp;
<span class="co0"># Reduced wait_timeout to prevent idle clients holding connections.</span>
<span class="re2">wait_timeout</span>=15
<span class="re2">connect_timeout</span>=<span class="nu0">10</span>
&nbsp;
<span class="co0"># Checked opened tables and adjusted accordingly after running for a while.</span>
<span class="re2">table_cache</span>=<span class="nu0">512</span>
&nbsp;
<span class="co0"># Reduced it to 32 to prevent memory hogging.</span>
<span class="re2">thread_cache</span>=<span class="nu0">32</span>
&nbsp;
<span class="co0"># Reduced it by checking current size of *.MYI files.</span>
<span class="re2">key_buffer</span>=128M
&nbsp;
<span class="re2">thread_concurrency</span>=<span class="nu0">1</span>
&nbsp;
log_error                = <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>mysql<span class="sy0">/</span>error.log
&nbsp;
<span class="co0"># log slow queries is a must.</span>
<span class="re2">log_slow_queries</span>=<span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>mysqld.slow.log
<span class="re2">long_query_time</span>=2
&nbsp;
<span class="br0">&#91;</span>mysqldump<span class="br0">&#93;</span>
quick
<span class="re2">max_allowed_packet</span>=16M
&nbsp;
<span class="br0">&#91;</span>mysql<span class="br0">&#93;</span>
no-auto-rehash
&nbsp;
<span class="br0">&#91;</span>isamchk<span class="br0">&#93;</span>
<span class="re2">key_buffer</span>=64M
<span class="re2">sort_buffer</span>=64M
<span class="re2">read_buffer</span>=16M
<span class="re2">write_buffer</span>=16M
&nbsp;
<span class="br0">&#91;</span>myisamchk<span class="br0">&#93;</span>
<span class="re2">key_buffer</span>=64M
<span class="re2">sort_buffer</span>=64M
<span class="re2">read_buffer</span>=16M
<span class="re2">write_buffer</span>=16M
&nbsp;
<span class="br0">&#91;</span>mysqlhotcopy<span class="br0">&#93;</span>
interactive-timeout</pre></div></div>


<p>Related posts:<ol><li><a href='http://bloke.org/linux/mysql-tuning-server-parameters/' rel='bookmark' title='Permanent Link: MySQL Tuning Server Parameters'>MySQL Tuning Server Parameters</a> <small>These are some of the handy MySQL 5.0 tweaks I...</small></li>
<li><a href='http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/' rel='bookmark' title='Permanent Link: [Snippet] Allow mysql root access from anywhere'>[Snippet] Allow mysql root access from anywhere</a> <small>A small annoyance of mine is on local development servers,...</small></li>
<li><a href='http://bloke.org/linux/installing-mytop-on-cpanel/' rel='bookmark' title='Permanent Link: Installing mytop on cpanel'>Installing mytop on cpanel</a> <small> MyTop is one of the best MySQL monitoring tools...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/linux/cpanel-mysql-tuning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Snippet] Manually reset a Wordpress password</title>
		<link>http://bloke.org/mysql/snippet-manually-reset-a-wordpress-password/</link>
		<comments>http://bloke.org/mysql/snippet-manually-reset-a-wordpress-password/#comments</comments>
		<pubDate>Wed, 19 May 2010 13:19:32 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://bloke.org/?p=720</guid>
		<description><![CDATA[Wordpress stores user passwords in MD5 checksums, so using your SQL admin tool of choice you can easily reset it.


Related posts:[Snippet] Allow mysql root access from anywhere A small annoyance of mine is on local development servers,...
Reset MySQL password on Ubuntu in about 1 second* * It may take a little longer depending on your...
How [...]


Related posts:<ol><li><a href='http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/' rel='bookmark' title='Permanent Link: [Snippet] Allow mysql root access from anywhere'>[Snippet] Allow mysql root access from anywhere</a> <small>A small annoyance of mine is on local development servers,...</small></li>
<li><a href='http://bloke.org/linux/reset-mysql-password-on-ubuntu-in-about-1-second/' rel='bookmark' title='Permanent Link: Reset MySQL password on Ubuntu in about 1 second*'>Reset MySQL password on Ubuntu in about 1 second*</a> <small>* It may take a little longer depending on your...</small></li>
<li><a href='http://bloke.org/php/how-to-move-wordpress-directory-or-server-properly/' rel='bookmark' title='Permanent Link: How to move Wordpress directory or server &#8211; properly'>How to move Wordpress directory or server &#8211; properly</a> <small>I ran into an annoying, but easily avoided problem the...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Wordpress stores user passwords in MD5 checksums, so using your SQL admin tool of choice you can easily reset it.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="sql" style="font-family:monospace;"><span class="kw1">UPDATE</span> <span class="st0">`wp_users`</span> <span class="kw1">SET</span> <span class="st0">`user_pass`</span> <span class="sy0">=</span> MD5<span class="br0">&#40;</span><span class="st0">'NEW PASSWORD'</span><span class="br0">&#41;</span> <span class="kw1">WHERE</span> <span class="st0">`wp_users`</span><span class="sy0">.</span><span class="st0">`user_login`</span> <span class="sy0">=</span> <span class="st0">&quot;THE USER&quot;</span> <span class="kw1">LIMIT</span> <span class="nu0">1</span></pre></div></div>


<p>Related posts:<ol><li><a href='http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/' rel='bookmark' title='Permanent Link: [Snippet] Allow mysql root access from anywhere'>[Snippet] Allow mysql root access from anywhere</a> <small>A small annoyance of mine is on local development servers,...</small></li>
<li><a href='http://bloke.org/linux/reset-mysql-password-on-ubuntu-in-about-1-second/' rel='bookmark' title='Permanent Link: Reset MySQL password on Ubuntu in about 1 second*'>Reset MySQL password on Ubuntu in about 1 second*</a> <small>* It may take a little longer depending on your...</small></li>
<li><a href='http://bloke.org/php/how-to-move-wordpress-directory-or-server-properly/' rel='bookmark' title='Permanent Link: How to move Wordpress directory or server &#8211; properly'>How to move Wordpress directory or server &#8211; properly</a> <small>I ran into an annoying, but easily avoided problem the...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/mysql/snippet-manually-reset-a-wordpress-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Snippet] Allow mysql root access from anywhere</title>
		<link>http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/</link>
		<comments>http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 17:34:26 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://bloke.org/?p=702</guid>
		<description><![CDATA[A small annoyance of mine is on local development servers, I can't login to the MySQL server as root.
Simply connect the mysql shell
mysq
Then,
Exit and you're done.


Related posts:cPanel MySQL Tuning The default configuration for MySQL provided by cPanel is pretty...
[Snippet] Stupid Simple cPanel Install Open a clean server, Go have your lunch. Maybe lunch...
Simple install of [...]


Related posts:<ol><li><a href='http://bloke.org/linux/cpanel-mysql-tuning/' rel='bookmark' title='Permanent Link: cPanel MySQL Tuning'>cPanel MySQL Tuning</a> <small>The default configuration for MySQL provided by cPanel is pretty...</small></li>
<li><a href='http://bloke.org/cpanelwhm/snippet-stupid-simple-cpanel-install/' rel='bookmark' title='Permanent Link: [Snippet] Stupid Simple cPanel Install'>[Snippet] Stupid Simple cPanel Install</a> <small>Open a clean server, Go have your lunch. Maybe lunch...</small></li>
<li><a href='http://bloke.org/linux/simple-install-of-memcached-on-ubuntu/' rel='bookmark' title='Permanent Link: Simple install of memcached on Ubuntu'>Simple install of memcached on Ubuntu</a> <small>Memcached is a free, high performance distributed memory object caching...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A small annoyance of mine is on local development servers, I can't login to the MySQL server as root.</p>
<p>Simply connect the mysql shell</p>
<p>mysq<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;">mysql <span class="re5">-u</span></pre></div></div></p>
<p>Then,</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;">GRANT ALL ON <span class="sy0">*</span>.<span class="sy0">*</span> TO <span class="st_h">'root'</span><span class="sy0">@</span><span class="st_h">'%'</span> IDENTIFIED BY <span class="st_h">'[A PASSWORD]'</span></pre></div></div>
<p>Exit and you're done.</p>


<p>Related posts:<ol><li><a href='http://bloke.org/linux/cpanel-mysql-tuning/' rel='bookmark' title='Permanent Link: cPanel MySQL Tuning'>cPanel MySQL Tuning</a> <small>The default configuration for MySQL provided by cPanel is pretty...</small></li>
<li><a href='http://bloke.org/cpanelwhm/snippet-stupid-simple-cpanel-install/' rel='bookmark' title='Permanent Link: [Snippet] Stupid Simple cPanel Install'>[Snippet] Stupid Simple cPanel Install</a> <small>Open a clean server, Go have your lunch. Maybe lunch...</small></li>
<li><a href='http://bloke.org/linux/simple-install-of-memcached-on-ubuntu/' rel='bookmark' title='Permanent Link: Simple install of memcached on Ubuntu'>Simple install of memcached on Ubuntu</a> <small>Memcached is a free, high performance distributed memory object caching...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting mytop to work on CentOS/Redhat</title>
		<link>http://bloke.org/linux/getting-mytop-to-work-on-centosredhat/</link>
		<comments>http://bloke.org/linux/getting-mytop-to-work-on-centosredhat/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 19:21:57 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://bloke.org/?p=438</guid>
		<description><![CDATA[Screw all these AJAXified, buzz-wordified MySQL monitors. I'm old school. I use the fantastic mytop tool Jeremy Zawodny created 9 years ago.
Unfortunately it won't run on CentOS. I got the error, 'Error in option spec: "long&#124;!"'
Fortunately, its a simple fix. Edit the perl script,
nano /usr/bin/mytop
Find the line
"long&#124;!" =&#62; \$config{long_nums},
and comment it out.
Simples.


Related posts:Installing mytop on [...]


Related posts:<ol><li><a href='http://bloke.org/linux/installing-mytop-on-cpanel/' rel='bookmark' title='Permanent Link: Installing mytop on cpanel'>Installing mytop on cpanel</a> <small> MyTop is one of the best MySQL monitoring tools...</small></li>
<li><a href='http://bloke.org/linux/i-hate-vi-aka-changing-your-default-crontab-editor/' rel='bookmark' title='Permanent Link: I hate vi. (aka Changing your default crontab editor)'>I hate vi. (aka Changing your default crontab editor)</a> <small>I'm trekking into the unknown - CentOS, but thats off...</small></li>
<li><a href='http://bloke.org/linux/snippet-centos-server-firewall-configuration/' rel='bookmark' title='Permanent Link: [Snippet] CentOS Server Firewall Configuration'>[Snippet] CentOS Server Firewall Configuration</a> <small>CentOS 5 Server has a nice text interface to configuring...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Screw all these AJAXified, buzz-wordified MySQL monitors. I'm old school. I use the fantastic <a href="http://jeremy.zawodny.com/mysql/mytop/">mytop</a> tool <a href="http://jeremy.zawodny.com/blog/">Jeremy Zawodny</a> created 9 years ago.</p>
<p>Unfortunately it won't run on CentOS. I got the error, <em>'Error in option spec: "long|!"'</em></p>
<p><span id="more-438"></span>Fortunately, its a simple fix. Edit the perl script,</p>
<p>nano /usr/bin/mytop</p>
<p>Find the line</p>
<p>"long|!" =&gt; \$config{long_nums},</p>
<p>and comment it out.</p>
<p>Simples.</p>


<p>Related posts:<ol><li><a href='http://bloke.org/linux/installing-mytop-on-cpanel/' rel='bookmark' title='Permanent Link: Installing mytop on cpanel'>Installing mytop on cpanel</a> <small> MyTop is one of the best MySQL monitoring tools...</small></li>
<li><a href='http://bloke.org/linux/i-hate-vi-aka-changing-your-default-crontab-editor/' rel='bookmark' title='Permanent Link: I hate vi. (aka Changing your default crontab editor)'>I hate vi. (aka Changing your default crontab editor)</a> <small>I'm trekking into the unknown - CentOS, but thats off...</small></li>
<li><a href='http://bloke.org/linux/snippet-centos-server-firewall-configuration/' rel='bookmark' title='Permanent Link: [Snippet] CentOS Server Firewall Configuration'>[Snippet] CentOS Server Firewall Configuration</a> <small>CentOS 5 Server has a nice text interface to configuring...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/linux/getting-mytop-to-work-on-centosredhat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLyog Query Profiler</title>
		<link>http://bloke.org/mysql/sqlyog-query-profiler/</link>
		<comments>http://bloke.org/mysql/sqlyog-query-profiler/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 12:49:03 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://bloke.org/?p=416</guid>
		<description><![CDATA[MySQL has always lacked the sophisticated profiling tools shipped with proprietary databases like SQL Server, etc. MySQL developers have largely depended on EXPLAIN for tuning queries. The SHOW PROFILE patch by Jeremy Cole was introduced in the MySQL Community version 5.0.37 and it provided much more insight into where the query spends its time. However, [...]


Related posts:<ol><li><a href='http://bloke.org/linux/mysql-tuning-server-parameters/' rel='bookmark' title='Permanent Link: MySQL Tuning Server Parameters'>MySQL Tuning Server Parameters</a> <small>These are some of the handy MySQL 5.0 tweaks I...</small></li>
<li><a href='http://bloke.org/php/yahoo-term-extractor/' rel='bookmark' title='Permanent Link: Yahoo Term Extractor'>Yahoo Term Extractor</a> <small>A recent project I was working on cause me to...</small></li>
<li><a href='http://bloke.org/linux/cpanel-mysql-tuning/' rel='bookmark' title='Permanent Link: cPanel MySQL Tuning'>cPanel MySQL Tuning</a> <small>The default configuration for MySQL provided by cPanel is pretty...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>MySQL has always lacked the sophisticated profiling tools shipped with proprietary databases like SQL Server, etc. MySQL developers have largely depended on EXPLAIN for tuning queries. The SHOW PROFILE patch by Jeremy Cole was introduced in the MySQL Community version 5.0.37 and it provided much more insight into where the query spends its time. However, to take advantage of this feature, MySQL developers were supposed to switch on profiling, run their queries and then filter the profiling data from a table that contained the profiling results of the last few profiled queries. A lot of manual book-keeping is required to take advantage of this powerful feature. In an ideal situation, the MySQL developer should execute the queries and the profiling info should be available along with the result-set. Unfortunately, none of the MySQL client tools (desktop or web-based) provide intrinsic support for this feature.</p>
<p><a href="http://vimeo.com/2929418">Watch the Screencast on Query Profiler.</a></p>
<p><a href="http://www.flickr.com/photos/68907151@N00/45751138"><img src="http://farm1.static.flickr.com/27/45751138_d7f5589826_m.jpg" alt="I♥MySQL" title="I♥MySQL" hspace="5" border="0" /></a></p>


<p>Related posts:<ol><li><a href='http://bloke.org/linux/mysql-tuning-server-parameters/' rel='bookmark' title='Permanent Link: MySQL Tuning Server Parameters'>MySQL Tuning Server Parameters</a> <small>These are some of the handy MySQL 5.0 tweaks I...</small></li>
<li><a href='http://bloke.org/php/yahoo-term-extractor/' rel='bookmark' title='Permanent Link: Yahoo Term Extractor'>Yahoo Term Extractor</a> <small>A recent project I was working on cause me to...</small></li>
<li><a href='http://bloke.org/linux/cpanel-mysql-tuning/' rel='bookmark' title='Permanent Link: cPanel MySQL Tuning'>cPanel MySQL Tuning</a> <small>The default configuration for MySQL provided by cPanel is pretty...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/mysql/sqlyog-query-profiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert phpBB IP Addresses</title>
		<link>http://bloke.org/php/convert-phpbb-ip-addresses/</link>
		<comments>http://bloke.org/php/convert-phpbb-ip-addresses/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:10:31 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://bloke.org/?p=350</guid>
		<description><![CDATA[phpBB stores its IP addresses in a funky format. They're useless to the human eye!
Convert them to normal IPs with the following code 
SELECT CONCAT( CONV( substring( poster_ip, 1, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 3, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 5, 2 ) [...]


Related posts:<ol><li><a href='http://bloke.org/linux/really-freakin-simple-mysql-virtual-hosting-pure-ftpd/' rel='bookmark' title='Permanent Link: Really freakin&#8217; simple mysql virtual hosting pure-ftpd'>Really freakin&#8217; simple mysql virtual hosting pure-ftpd</a> <small>This article will guide you through installing pure-ftpd configured for...</small></li>
<li><a href='http://bloke.org/linux/why-does-perl-consume-my-entire-cpu/' rel='bookmark' title='Permanent Link: Why does perl consume my entire CPU?'>Why does perl consume my entire CPU?</a> <small>I use a perl script to convert an Excel file...</small></li>
<li><a href='http://bloke.org/linux/mod_geoip-revisted-including-stopping-spam-in-phpbb-2/' rel='bookmark' title='Permanent Link: mod_geoip Revisted including stopping spam in phpBB 2'>mod_geoip Revisted including stopping spam in phpBB 2</a> <small>I've recently moved a client's forum onto a new cPanel...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>phpBB stores its IP addresses in a funky format. They're useless to the human eye!</p>
<p>Convert them to normal IPs with the following code </p>
<pre lang="sql">SELECT CONCAT( CONV( substring( poster_ip, 1, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 3, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 5, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 7, 2 ) , 16, 10 ) ) AS IP
FROM phpbb_posts
WHERE `poster_id` = USERID
LIMIT 0 , 30 </pre>
<p>This code will convert all know IPs from a selected user (In my case 51).</p>


<p>Related posts:<ol><li><a href='http://bloke.org/linux/really-freakin-simple-mysql-virtual-hosting-pure-ftpd/' rel='bookmark' title='Permanent Link: Really freakin&#8217; simple mysql virtual hosting pure-ftpd'>Really freakin&#8217; simple mysql virtual hosting pure-ftpd</a> <small>This article will guide you through installing pure-ftpd configured for...</small></li>
<li><a href='http://bloke.org/linux/why-does-perl-consume-my-entire-cpu/' rel='bookmark' title='Permanent Link: Why does perl consume my entire CPU?'>Why does perl consume my entire CPU?</a> <small>I use a perl script to convert an Excel file...</small></li>
<li><a href='http://bloke.org/linux/mod_geoip-revisted-including-stopping-spam-in-phpbb-2/' rel='bookmark' title='Permanent Link: mod_geoip Revisted including stopping spam in phpBB 2'>mod_geoip Revisted including stopping spam in phpBB 2</a> <small>I've recently moved a client's forum onto a new cPanel...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/php/convert-phpbb-ip-addresses/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Retro Fitting Record Pagination with ADOdb</title>
		<link>http://bloke.org/php/161/</link>
		<comments>http://bloke.org/php/161/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 11:29:52 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://bloke.org/wordpress/2008/01/02/161/</guid>
		<description><![CDATA[For my first project of the New Year I had to retro-fit pagination controls to an existing ADOdb powered web application for a client of mine. Looking back at my previous post on this topic, it was relatively simple to add the required features. Hers's how I did it.
It's nice to see my original article [...]


Related posts:<ol><li><a href='http://bloke.org/php/nicer-pagination-with-adodb/' rel='bookmark' title='Permanent Link: Nicer Pagination with ADOdb'>Nicer Pagination with ADOdb</a> <small>Or should that be Nicr? To follow in an annoying...</small></li>
<li><a href='http://bloke.org/php/xhtml-transitional-compliant-paging-with-adodb/' rel='bookmark' title='Permanent Link: XHTML Transitional Compliant Paging with ADOdb'>XHTML Transitional Compliant Paging with ADOdb</a> <small>Following on from my previous post, I've cleaned up the...</small></li>
<li><a href='http://bloke.org/php/jpgraph-part-1/' rel='bookmark' title='Permanent Link: JPGraph Part 1'>JPGraph Part 1</a> <small>I really like JPGraph now. For too long I hated...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>For my first project of the New Year I had to retro-fit pagination controls to an existing ADOdb powered web application for a client of mine. Looking back at my previous post on this topic, it was relatively simple to add the required features. Hers's how I did it.<span id="more-161"></span></p>
<p>It's nice to see <a href="http://bloke.org/wordpress/2007/07/07/nicer-pagination-with-adodb/" target="_blank">my original article</a> still <a href="http://www.google.co.uk/search?q=adodb+pagination&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-GB:official&amp;client=firefox-a" target="_blank">ranks high</a> on Google.</p>
<p>First step, include the pagination class file.</p>
<pre lang="php">require_once '../_common_includes/class.GenericEasyPagination.php';</pre>
<p>Step two, define a couple of variables. The first block of code relates to the actual navigation, the second relates to the number of records to be shown per page.</p>
<pre lang="php">if ($_GET["page"]!="") {
$page = $_GET["page"];
}
else {
$page = 1;
}
define('CURRENT_PAGE',$page);
define('RECORDS_BY_PAGE',50);</pre>
<p>Step three, change your $conn-&gt;Execute() call to PageExecute(), like so</p>
<pre lang="php">$rs = $conn-&gt;PageExecute($SQL,RECORDS_BY_PAGE,CURRENT_PAGE);</pre>
<p>Finally, step four, the navigation links &amp; images</p>
<pre lang="php">$recordsFound = $rs-&gt;_maxRecordCount;
echo '&lt;div class="table_footer"&gt;';
$GenericEasyPagination =&amp; new GenericEasyPagination($page,RECORDS_BY_PAGE,"eng");
$GenericEasyPagination-&gt;setTotalRecords($recordsFound);
echo "Records: ".$GenericEasyPagination-&gt;getListCurrentRecords();
echo " of ".$recordsFound;
echo "&lt;br /&gt;";
echo '&lt;/div&gt;';
echo $GenericEasyPagination-&gt;getNavigation();</pre>
<p>You should get something like this at the bottom</p>
<p><img src="http://bloke.org/wordpress/wp-content/uploads/2008/01/untitled.JPG" alt="untitled.JPG" /></p>
<p>Easy.</p>


<p>Related posts:<ol><li><a href='http://bloke.org/php/nicer-pagination-with-adodb/' rel='bookmark' title='Permanent Link: Nicer Pagination with ADOdb'>Nicer Pagination with ADOdb</a> <small>Or should that be Nicr? To follow in an annoying...</small></li>
<li><a href='http://bloke.org/php/xhtml-transitional-compliant-paging-with-adodb/' rel='bookmark' title='Permanent Link: XHTML Transitional Compliant Paging with ADOdb'>XHTML Transitional Compliant Paging with ADOdb</a> <small>Following on from my previous post, I've cleaned up the...</small></li>
<li><a href='http://bloke.org/php/jpgraph-part-1/' rel='bookmark' title='Permanent Link: JPGraph Part 1'>JPGraph Part 1</a> <small>I really like JPGraph now. For too long I hated...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/php/161/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yahoo Term Extractor</title>
		<link>http://bloke.org/php/yahoo-term-extractor/</link>
		<comments>http://bloke.org/php/yahoo-term-extractor/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 22:42:59 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[HTML, CSS, AJAX]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://bloke.org/wordpress/2007/08/01/yahoo-term-extractor/</guid>
		<description><![CDATA[A recent project I was working on cause me to stumble over the Yahoo Term Extractor. Something I had previously never heard of - it is a very underrated tool.
The Term Extraction Web Service provides a list of significant words or phrases extracted from a larger content.
So give it a paragraph of text, for example [...]


Related posts:<ol><li><a href='http://bloke.org/php/yahoo-geolocation-api/' rel='bookmark' title='Permanent Link: Yahoo GeoLocation API'>Yahoo GeoLocation API</a> <small>The Yahoo Maps API is the best API I've found...</small></li>
<li><a href='http://bloke.org/php/captcha-generation/' rel='bookmark' title='Permanent Link: CAPTCHA Image Generation'>CAPTCHA Image Generation</a> <small>I couldn't find a very good CAPTCHA generation script in...</small></li>
<li><a href='http://bloke.org/php/kb_captcha-captcha-image-generation-in-php/' rel='bookmark' title='Permanent Link: KB_CAPTCHA &#8211; CAPTCHA Image Generation in PHP'>KB_CAPTCHA &#8211; CAPTCHA Image Generation in PHP</a> <small> Introduction KB_Captcha is a simple PHP script to generate...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A recent project I was working on cause me to stumble over the <a href="https://developer.yahoo.com/search/content/V1/termExtraction.html" target="_blank">Yahoo Term Extractor</a>. Something I had previously never heard of - it is a very underrated tool.</p>
<p>The Term Extraction Web Service provides a list of significant words or phrases extracted from a larger content.<span id="more-101"></span></p>
<p>So give it a paragraph of text, for example an article, a blog entry, or in my case a converted document (MS Word or PDF) and it will give you the most common and significant words or phrases.</p>
<p>It can help in "<a href="http://en.wikipedia.org/wiki/Collaborative_tagging" target="_blank">tagging</a>" or other <a href="http://en.wikipedia.org/wiki/Metadata" target="_blank">meta data</a> (<a href="http://en.wikipedia.org/wiki/Tag_%28metadata%29" target="_blank">2</a>) reliant applications. You can never trust users to submit decent tags.</p>
<p>Go on, give it a try. You'll need an <a href="https://login.yahoo.com/config/login_verify2?.src=devnet&amp;.done=https%3A%2F%2Fdeveloper.yahoo.com%2Fwsregapp%2Findex.php" target="_blank">Application Key</a> mind.</p>
<p>Create a simple HTML form and give it a go.</p>
<pre line="1" lang="php">
&lt;form id="form1" name="form1" method="post" action="http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction" /&gt;&lt;input name="appid" type="text" id="appid" value="YOUR-APPLICATION-ID" size="80" /&gt;
&lt;br /&gt;

&lt;textarea name="context" id="context" cols="45" rows="5"&gt;&lt;/textarea&gt;

&lt;br /&gt;

&lt;input type="submit" name="button" id="button" value="Submit" /&gt;

&lt;/form&gt;</pre>
<p>You can even add an optional query to help with the extraction process.</p>
<pre line="1" lang="php"> &lt;input name="query" type="text" id="query" size="80" /&gt;</pre>
<p>Once I figured it out, I decided to loop over my existing data populate the meta data. Dam, users.</p>
<pre line="1" lang="php">$data = array('appid' =&gt; "YOUR-APPLICATION-ID", 'context' =&gt; 'TABLE-DATA');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$yte_input = curl_exec($ch);
curl_close($ch);

$phpobject = simplexml_load_string($yte_input);

foreach($phpobject as $term) {
$rs_yte = $conn-&gt;Execute(YOUR INSERT QUERY);
}</pre>
<p>Simple as <a href="http://uk3.php.net/simplexml" target="_blank">SimpleXML</a>!</p>


<p>Related posts:<ol><li><a href='http://bloke.org/php/yahoo-geolocation-api/' rel='bookmark' title='Permanent Link: Yahoo GeoLocation API'>Yahoo GeoLocation API</a> <small>The Yahoo Maps API is the best API I've found...</small></li>
<li><a href='http://bloke.org/php/captcha-generation/' rel='bookmark' title='Permanent Link: CAPTCHA Image Generation'>CAPTCHA Image Generation</a> <small>I couldn't find a very good CAPTCHA generation script in...</small></li>
<li><a href='http://bloke.org/php/kb_captcha-captcha-image-generation-in-php/' rel='bookmark' title='Permanent Link: KB_CAPTCHA &#8211; CAPTCHA Image Generation in PHP'>KB_CAPTCHA &#8211; CAPTCHA Image Generation in PHP</a> <small> Introduction KB_Captcha is a simple PHP script to generate...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/php/yahoo-term-extractor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset MySQL password on Ubuntu in about 1 second*</title>
		<link>http://bloke.org/linux/reset-mysql-password-on-ubuntu-in-about-1-second/</link>
		<comments>http://bloke.org/linux/reset-mysql-password-on-ubuntu-in-about-1-second/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 11:57:30 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://bloke.org/wordpress/2007/07/17/reset-mysql-password-on-ubuntu-in-about-1-second/</guid>
		<description><![CDATA[* It may take a little longer depending on your server and finger speeds!
dpkg-reconfigure mysql-server-5.0


Related posts:[Snippet] Manually reset a Wordpress password Wordpress stores user passwords in MD5 checksums, so using your...
MySQL Tuning Server Parameters These are some of the handy MySQL 5.0 tweaks I...
[Snippet] Allow mysql root access from anywhere A small annoyance of mine [...]


Related posts:<ol><li><a href='http://bloke.org/mysql/snippet-manually-reset-a-wordpress-password/' rel='bookmark' title='Permanent Link: [Snippet] Manually reset a Wordpress password'>[Snippet] Manually reset a Wordpress password</a> <small>Wordpress stores user passwords in MD5 checksums, so using your...</small></li>
<li><a href='http://bloke.org/linux/mysql-tuning-server-parameters/' rel='bookmark' title='Permanent Link: MySQL Tuning Server Parameters'>MySQL Tuning Server Parameters</a> <small>These are some of the handy MySQL 5.0 tweaks I...</small></li>
<li><a href='http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/' rel='bookmark' title='Permanent Link: [Snippet] Allow mysql root access from anywhere'>[Snippet] Allow mysql root access from anywhere</a> <small>A small annoyance of mine is on local development servers,...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>* It may take a little longer depending on your server and finger speeds!</p>
<p><code>dpkg-reconfigure mysql-server-5.0</code></p>


<p>Related posts:<ol><li><a href='http://bloke.org/mysql/snippet-manually-reset-a-wordpress-password/' rel='bookmark' title='Permanent Link: [Snippet] Manually reset a Wordpress password'>[Snippet] Manually reset a Wordpress password</a> <small>Wordpress stores user passwords in MD5 checksums, so using your...</small></li>
<li><a href='http://bloke.org/linux/mysql-tuning-server-parameters/' rel='bookmark' title='Permanent Link: MySQL Tuning Server Parameters'>MySQL Tuning Server Parameters</a> <small>These are some of the handy MySQL 5.0 tweaks I...</small></li>
<li><a href='http://bloke.org/mysql/snippet-allow-mysql-root-access-from-anywhere/' rel='bookmark' title='Permanent Link: [Snippet] Allow mysql root access from anywhere'>[Snippet] Allow mysql root access from anywhere</a> <small>A small annoyance of mine is on local development servers,...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/linux/reset-mysql-password-on-ubuntu-in-about-1-second/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MySQL Tuning Server Parameters</title>
		<link>http://bloke.org/linux/mysql-tuning-server-parameters/</link>
		<comments>http://bloke.org/linux/mysql-tuning-server-parameters/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 15:54:03 +0000</pubDate>
		<dc:creator>Kieran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://bloke.org/wordpress/2007/07/13/mysql-tuning-server-parameters/</guid>
		<description><![CDATA[These are some of the handy MySQL 5.0 tweaks I do to get the most out a MySQL database;
I adjust the following to suit my server, I try to give MySQL as much resource as possible.

key_buffer = 48M
max_allowed_packet = 8M
table_cache = 128
sort_buffer_size = 48M
net_buffer_length = 8M
thread_cache_size = 4
query_cache_type = 1
query_cache_size = 4M
query_cache - this caches [...]


Related posts:<ol><li><a href='http://bloke.org/linux/cpanel-mysql-tuning/' rel='bookmark' title='Permanent Link: cPanel MySQL Tuning'>cPanel MySQL Tuning</a> <small>The default configuration for MySQL provided by cPanel is pretty...</small></li>
<li><a href='http://bloke.org/mysql/sqlyog-query-profiler/' rel='bookmark' title='Permanent Link: SQLyog Query Profiler'>SQLyog Query Profiler</a> <small>MySQL has always lacked the sophisticated profiling tools shipped with...</small></li>
<li><a href='http://bloke.org/linux/getting-mytop-to-work-on-centosredhat/' rel='bookmark' title='Permanent Link: Getting mytop to work on CentOS/Redhat'>Getting mytop to work on CentOS/Redhat</a> <small>Screw all these AJAXified, buzz-wordified MySQL monitors. I'm old school....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>These are some of the handy MySQL 5.0 tweaks I do to get the most out a MySQL database;<br />
I adjust the following to suit my server, I try to give MySQL as much resource as possible.</p>
<p><span id="more-52"></span><br />
<code>key_buffer = 48M<br />
max_allowed_packet = 8M<br />
table_cache = 128<br />
sort_buffer_size = 48M<br />
net_buffer_length = 8M<br />
thread_cache_size = 4<br />
query_cache_type = 1<br />
query_cache_size = 4M</code></p>
<p>query_cache - this caches repeated SQL queries.<br />
key_buffer - used for caching primary key indexes.<br />
table_cache - tells mysql how many table files handles to keep open simultaneously.<br />
thread_cache_size - this tells mysql to keep worker threads around which are expensive to start up, but cheap to maintain<br />
sort_buffer_size - this value is used during queries to hold results in memory otherwise it creates temporary result tables on disk<br />
net_buffer_length - should help on larger network based queries to improve throughput</p>
<p>Stolen and tweaked from the <a href="http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html" target="_blank">MySQL manual</a>.<br />
You can see your current cache usage by running the following.</p>
<p><code>SHOW STATUS LIKE "%cache"</code></p>
<ul>
<li>If you don't use replication comment out the  log_bin feature. <a href="http://dev.mysql.com/doc/refman/5.0/en/binary-log.html" target="_blank">See manual</a>.</li>
<li>If you don't use InnoDB un-comment the skip-innodb feature. <a href="http://dev.mysql.com/doc/refman/5.0/en/innodb-overview.html" target="_blank">See manual</a>.</li>
<li>If you don't know what the above two features are, then do it!</li>
</ul>
<p>I like to set a default charset too. It saves any confusion later on in life.<br />
Add the following to my.cnf</p>
<p><code>collation_server=latin1_general_ci</code></p>
<p>Don't forget to restart MySQL afterwards.</p>
<p>Finally, I always install Jeremy Zawodny's <a href="http://jeremy.zawodny.com/mysql/mytop/" target="_blank">mytop</a> tool. If you use <strike>lazy-linux</strike> Ubuntu, you can apt-get it.</p>
<p><code>apt-get install mytop</code></p>


<p>Related posts:<ol><li><a href='http://bloke.org/linux/cpanel-mysql-tuning/' rel='bookmark' title='Permanent Link: cPanel MySQL Tuning'>cPanel MySQL Tuning</a> <small>The default configuration for MySQL provided by cPanel is pretty...</small></li>
<li><a href='http://bloke.org/mysql/sqlyog-query-profiler/' rel='bookmark' title='Permanent Link: SQLyog Query Profiler'>SQLyog Query Profiler</a> <small>MySQL has always lacked the sophisticated profiling tools shipped with...</small></li>
<li><a href='http://bloke.org/linux/getting-mytop-to-work-on-centosredhat/' rel='bookmark' title='Permanent Link: Getting mytop to work on CentOS/Redhat'>Getting mytop to work on CentOS/Redhat</a> <small>Screw all these AJAXified, buzz-wordified MySQL monitors. I'm old school....</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://bloke.org/linux/mysql-tuning-server-parameters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
