<?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>Kwatog &#38; Co &#187; MySQL</title>
	<atom:link href="http://kwatog.com/category/blog/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://kwatog.com</link>
	<description>tech notes and general nonsense</description>
	<lastBuildDate>Fri, 04 May 2012 07:34:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>SpotVPS First Impressions</title>
		<link>http://kwatog.com/blog/spotvps-first-impressions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=spotvps-first-impressions</link>
		<comments>http://kwatog.com/blog/spotvps-first-impressions/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 07:57:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NGINX]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=706</guid>
		<description><![CDATA[After the unfortunate incident last week with NordicVPS, I decided to look for a new VPS host. As usual, I went to lowendbox and get the reviews in webhostingtalk. It&#8217;s there where I stumbled upon a promo from SpotVPS. As it turns out, SpotVPS is a low-cost VPS offering of ComfortHost.NET. And who are they?&#8230;]]></description>
			<content:encoded><![CDATA[<p>After the unfortunate incident last week with NordicVPS, I decided to look for a new VPS host. As usual, I went to lowendbox and get the reviews in webhostingtalk. It&#8217;s there where I stumbled upon a promo from <a href="http://www.comforthost.net/billing/aff.php?aff=115">SpotVPS</a>. As it turns out, SpotVPS is a low-cost VPS offering of ComfortHost.NET.</p>
<p>And who are they? Here&#8217;s what they say about themselves.</p>
<blockquote><p>
ComfortHost.NET have been here since 2004 offer high quality web hosting solutions. All SpotVPS nodes are fully owned hardware and are colocated. All servers used by SpotVPS have been bought with internal cash. Our only monthly cost for these servers are the actual colocation. We are financially healthy and profitable since day one. We are NOT going out of buisness any time soon. We are in it for the long run!
</p></blockquote>
<p>ComfortHost on http://www.webhostingtalk.com/showthread.php?t=1110770</p>
<p>Here&#8217;s the plan that I got.<br />
$6.99/mo Ultimate Plan<br />
Memory: 2048mb (2gb)<br />
HD Space: 50gb (50,000mb)<br />
Bandwidth: 1,000gb (1TB)<br />
Monthly Price: $6.99/mo<br />
Setup Fee: FREE!<br />
FREE GIGABIT PORT &#8211; FREE WEEKLY BACKUPS &#8211; FREE HARDWARE RAID<br />
Location: Orlando, FL at DimeNOC<br />
Test IP Address: 72.29.87.105</p>
<p>2GB RAM for $6.99. That&#8217;s sweet. Want to try it yourself? <a href="http://www.comforthost.net/billing/aff.php?aff=115">ORDER NOW</a></p>
<p>Word of caution,though. This plan (and all other dirt-cheap vps that I know of) comes with very limited support. You are usually given your VPS, IP and OS install and you have to do the rest. I installed mine with NGiNx, PHP, MySQL and it&#8217;s already up and running for 7 days straight now. </p>
<p>Here&#8217;s the result of the test I made on my VPS.<br />
<code><br />
[root@vps ~]# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync<br />
16384+0 records in<br />
16384+0 records out<br />
1073741824 bytes (1.1 GB) copied, 14.9939 seconds, 71.6 MB/s</p>
<p>[root@vps ~]# wget cachefly.cachefly.net/100mb.test<br />
--2011-11-24 18:10:35-- http://cachefly.cachefly.net/100mb.test<br />
Resolving cachefly.cachefly.net... 205.234.175.175<br />
Connecting to cachefly.cachefly.net|205.234.175.175|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
Length: 104857600 (100M) [application/octet-stream]<br />
Saving to: `100mb.test'</p>
<p>100%[==============================================================================================================================>] 104,857,600 66.8M/s in 1.5s<br />
2011-11-24 18:10:36 (66.8 MB/s) - `100mb.test' saved [104857600/104857600]<br />
</code></p>
<p>I&#8217;ll try to come up with a review together with my other hosting providers. <img src='http://kwatog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/spotvps-first-impressions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Upgrade MySQL 5.0 to 5.5 in CentOS</title>
		<link>http://kwatog.com/blog/how-to-upgrade-mysql-5-0-to-5-5-in-centos/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-upgrade-mysql-5-0-to-5-5-in-centos</link>
		<comments>http://kwatog.com/blog/how-to-upgrade-mysql-5-0-to-5-5-in-centos/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 16:19:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=651</guid>
		<description><![CDATA[I upgraded the installed MySQL on my two VPSes about two months ago and I thought I already saved the steps somewhere or at least the saved the URL of the how to. I did not so when I tried to upgrade the Pagudpud Resort&#8216;s (owned by the Jackoleros) database server, I don&#8217;t know where&#8230;]]></description>
			<content:encoded><![CDATA[<p>I upgraded the installed MySQL on my two VPSes about two months ago and I thought I already saved the steps somewhere or at least the saved the URL of the how to. I did not so when I tried to upgrade the <a href="http://pagudpud-resort.com">Pagudpud Resort</a>&#8216;s (owned by the Jackoleros) database server, I don&#8217;t know where to start. The MySQL official website suggests(or at least, that&#8217;s how I understand it) that I recompile. I know I did not recompile before so after some fruitless googling, I finally found a working version. But first, thanks to <a href="http://blog.famillecollet.com/pages/English-site-introduction">remi</a> for sharing the rpm.<br />
<span id="more-651"></span><br />
Before we proceed, I&#8217;d like to remind you that this is for <strong>MySQL 5.5.14</strong> on <strong>CentOS 5.6</strong>. My original MySQL install was 5.x. If your baseline environment is different from mine, then I suggest you look elsewhere for the tutorial. The source at the end of this post may help.</p>
<p>**** UPDATE *****<br />
The following steps require the EPEL (Extra Packages for Enterprise Linux) so you&#8217;ll have to install epel first before proceeding. Here&#8217;s the command:<br />
<code>rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm</code></p>
<p><strong>Step 1</strong> login as root to your vps</p>
<p><strong>Step 2</strong> Install Remi repository<br />
<code>rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm</code><br />
The result will something like..<br />
<code>Retrieving http://rpms.famillecollet.com/enterprise/remi-release-5.rpm<br />
warning: /var/tmp/rpm-xfer.cVJJxn: Header V3 DSA signature: NOKEY, key ID 00f97f56<br />
Preparing...                ########################################### [100%]<br />
   1:remi-release           ########################################### [100%]</code></p>
<p><strong>Step 3</strong> Check availability of MySQL versions<br />
<code>yum --enablerepo=remi,remi-test list mysql mysql-server</code></p>
<p>the last lines of the output should be something like this.<br />
<code><br />
Available Packages<br />
mysql.i386                                5.5.14-1.el5.remi                          remi<br />
mysql-server.i386                         5.5.14-1.el5.remi                          remi<br />
[root@one ~]#<br />
</code></p>
<p><strong>Step 4</strong> Update or Install MySQL<br />
<code>yum --enablerepo=remi,remi-test install mysql mysql-server</strong></p>
<p><strong>Step 5</strong> Restart MySQL<br />
<code>service mysqld start</code></p>
<p><strong>Step 6</strong> Upgrade MySQL Databases<br />
<code>mysql_upgrade -u root -p</code></p>
<p>***** NOTE : THE LAST STEP IS VERY IMPORTANT BECAUSE IT WILL CREATE PRIVILEGE TABLES ******</p>
<p>Source :</p>
<p>http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/how-to-upgrade-mysql-5-0-to-5-5-in-centos/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Update User Password in MySQL</title>
		<link>http://kwatog.com/blog/update-user-password-in-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=update-user-password-in-mysql</link>
		<comments>http://kwatog.com/blog/update-user-password-in-mysql/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 11:47:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=606</guid>
		<description><![CDATA[Apparently, quite a number of people are looking into my humble website trying to find out how to change a password of an existing user. Doing this is easy in Oracle with a ALTER USER command. In MySQL, it is different in such a way that you need to update a table. Here&#8217;s the command.&#8230;]]></description>
			<content:encoded><![CDATA[<p>Apparently, quite a number of people are looking into my humble website trying to find out how to change a password of an existing user. Doing this is easy in Oracle with a ALTER USER command. In <strong>MySQL</strong>, it is different in such a way that you need to update a table. Here&#8217;s the command.<br />
<span id="more-606"></span><br />
<code><br />
UPDATE mysql.user<br />
SET password = PASSWORD('mynewpassword')<br />
WHERE user = 'kwatog'; </p>
<p>FLUSH PRIVILEGES;<br />
</code></p>
<p>An alternative (and apparently official one) is by using the syntax below.</p>
<p><code>SET PASSWORD [FOR user] =<br />
    {<br />
        PASSWORD('some password')<br />
      | OLD_PASSWORD('some password')<br />
      | 'encrypted password'<br />
    }</code></p>
<p>Example :<br />
<code><br />
SET PASSWORD 'kwatog'@'localhost = PASSWORD('mynewpassword')<br />
</code></p>
<p>Still can&#8217;t believe? Go head to the official documentation of MySQL at the following URL.</p>
<p>http://dev.mysql.com/doc/refman/5.0/en/set-password.html</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/update-user-password-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Fail To Start After Upgrade to 5.1 or higher</title>
		<link>http://kwatog.com/blog/mysql-fail-to-start-after-upgrade-to-5-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-fail-to-start-after-upgrade-to-5-1</link>
		<comments>http://kwatog.com/blog/mysql-fail-to-start-after-upgrade-to-5-1/#comments</comments>
		<pubDate>Sun, 15 May 2011 01:37:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=535</guid>
		<description><![CDATA[I recently upgraded my MySQL in preparation for WordPress 3.2. The version I now have is 5.5.12. The upgrade finished without a hitch but when I tried to restart the service, the MySQL Daemon failed. Here&#8217;s the log of mysql (/var/log/mysqld.log) 110514 14:04:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 110514 14:04:22 [Note] Plugin&#8230;]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my MySQL in preparation for WordPress 3.2. The version I now have is 5.5.12. The upgrade finished without a hitch but when I tried to restart the service, the MySQL Daemon failed. </p>
<p>Here&#8217;s the log of mysql (/var/log/mysqld.log)<br />
<code><br />
110514 14:04:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql<br />
110514 14:04:22 [Note] Plugin 'InnoDB' is disabled.<br />
110514 14:04:22 [Note] Plugin 'FEDERATED' is disabled.<br />
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist<br />
110514 14:04:22 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.<br />
110514 14:04:22 [ERROR] Unknown/unsupported storage engine: InnoDB<br />
110514 14:04:22 [ERROR] Aborting<br />
</code></p>
<p>Initially, I thought the problem was on the mysql_upgrade part because that&#8217;s the first error that appears on the log. Apparently, that&#8217;s just a warning message because the service still managed to proceed to the next step which is for the InnoDB. And based on the log, it failed to start and actually aborted. So that&#8217;s where I should concentrate my investigation/trial-and-error.</p>
<h3>Solution</h3>
<p>I opened /etc/my.cnf and comment out skip-innodb and then restart mysqld. It fixed the problem and mysql managed to start. I then proceeded with the mysql_upgrade which is unrelated to the error.</p>
<p>Another solution for this is to set the default storage to other than InnoDB. However, I haven&#8217;t tried that myself.</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/mysql-fail-to-start-after-upgrade-to-5-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Dump and Reload</title>
		<link>http://kwatog.com/blog/mysql/mysql-dump-reload/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-dump-reload</link>
		<comments>http://kwatog.com/blog/mysql/mysql-dump-reload/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 16:21:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[load]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=133</guid>
		<description><![CDATA[This one has been on my draft for more than a year already so I better fix it up and share. Besides, I find myself more and more googling my site to find my posts instead of searching via the WP admin. Without further ado, here it is.. MySQL Dump This command saves/backup your database&#8230;]]></description>
			<content:encoded><![CDATA[<p>This one has been on my draft for more than a year already so I better fix it up and share. Besides, I find myself more and more googling my site to find my posts instead of searching via the WP admin. Without further ado, here it is..<br />
<span id="more-133"></span><br />
<strong>MySQL Dump</strong><br />
This command saves/backup your database into a file. The simplest use of this is to backup the whole database.<br />
<code><br />
mysqldump -u&lt;db_user_id&gt; -p &lt;db_name&gt; &gt; &lt;path/filename.sql&gt;<br />
</code><br />
Of course, there&#8217;s a whole set of options that comes with it but I&#8217;ll not cover that for now.<br />
<code><br />
mysqldump -uroot -p wp_dbase &gt; /usr/kwatog/wpdb_20100813.sql<br />
</code><br />
Take note that you&#8217;ll be asked for password when you launch this command.</p>
<p><strong>Reload MySQL Backup to DB</strong><br />
In case you want to reload your backup, here&#8217;s the syntax for it.<br />
<code><br />
mysql -u&lt;dbuserid&gt; -p &lt;dbase_name&gt; &lt;  &lt;path/filename&gt;<br />
</code></p>
<p>Sample<br />
<code><br />
mysql -uroot -p wp_dbase &lt; /usr/kwatog/wpdb_20100813.sql<br />
</code></p>
<p>Again, it&#8217;s so easy, no? </p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/mysql/mysql-dump-reload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date Functions in MySQL</title>
		<link>http://kwatog.com/blog/date-function-in-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=date-function-in-mysql</link>
		<comments>http://kwatog.com/blog/date-function-in-mysql/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 01:23:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[add_months]]></category>
		<category><![CDATA[date_add]]></category>
		<category><![CDATA[months_between]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=382</guid>
		<description><![CDATA[Here&#8217;s few of the usual equivalent Oracle data functions in MySQL. DATE ADD (SYSDATE +/-1) SELECT DATE_ADD(SYSDATE(),INTERVAL 1 DAY); SELECT DATE_ADD(SYSDATE(),INTERVAL -10 DAY); ADD_MONTHS SELECT DATE_ADD(SYSDATE(),INTERVAL 1 MONTH); TRUNC() SELECT DATE(SYSDATE()); TO_DATE() SELECT STR_TO_DATE( '07-08-2010', '%d-%m-%Y' ); TIME DIFFERENCE SELECT TIMESTAMPDIFF( SECOND , '2010-01-07 23:50:59', SYSDATE( ) ) /3600 /24 day, TIMESTAMPDIFF( SECOND , '2010-01-07&#8230;]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s few of the usual equivalent Oracle data functions in MySQL.</p>
<p><strong>DATE ADD (SYSDATE +/-1)</strong><br />
<code><br />
SELECT DATE_ADD(SYSDATE(),INTERVAL 1 DAY);<br />
SELECT DATE_ADD(SYSDATE(),INTERVAL -10 DAY);<br />
</code><br />
<span id="more-382"></span><br />
<strong>ADD_MONTHS</strong><br />
<code><br />
SELECT DATE_ADD(SYSDATE(),INTERVAL 1 MONTH);<br />
</code></p>
<p><strong>TRUNC()</strong><br />
<code><br />
SELECT DATE(SYSDATE());<br />
</code></p>
<p><strong>TO_DATE()</strong><br />
<code><br />
SELECT STR_TO_DATE( '07-08-2010', '%d-%m-%Y' );</code></p>
<p><strong>TIME DIFFERENCE</strong><br />
<code><br />
SELECT TIMESTAMPDIFF(<br />
SECOND , '2010-01-07 23:50:59', SYSDATE( ) ) /3600 /24 day,<br />
TIMESTAMPDIFF(<br />
SECOND , '2010-01-07 23:50:59', SYSDATE( ) )  /3600 hours,<br />
TIMESTAMPDIFF(<br />
SECOND , '2010-01-07 23:50:59', SYSDATE( ) )  /60 mins,<br />
TIMESTAMPDIFF(<br />
SECOND , '2010-01-07 23:50:59', SYSDATE( ) )  secs,<br />
</code><br />
In the preceding example, I could have just used HOUR, MINUTE, DAY, MONTH or YEAR interval but in real world, I mostly use SECOND for a more accurate results. That&#8217;s not to say timestampdiff is not accurate. Maybe because I&#8217;m used in how I do it in Oracle. </p>
<p><strong>MONTHS_BETWEEN</strong><br />
<code><br />
SELECT TIMESTAMPDIFF(<br />
MONTH , '2010-01-07', SYSDATE( ) )  no_months<br />
</code></p>
<table>
<tr>
<td><strong>Specifier</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td><code>%a</code></td>
<td>Abbreviated weekday name                   (<code>Sun</code>..<code>Sat</code>)</td>
</tr>
<tr>
<td><code>%b</code></td>
<td>Abbreviated month name (<code>Jan</code>..<code>Dec</code>)</td>
</tr>
<tr>
<td><code>%c</code></td>
<td>Month, numeric (<code>0</code>..<code>12</code>)</td>
</tr>
<tr>
<td><code>%D</code></td>
<td>Day of the month with English suffix (<code>0th</code>,                   <code>1st</code>, <code>2nd</code>,                   <code>3rd</code>, …)</td>
</tr>
<tr>
<td><code>%d</code></td>
<td>Day of the month, numeric (<code>00</code>..<code>31</code>)</td>
</tr>
<tr>
<td><code>%e</code></td>
<td>Day of the month, numeric (<code>0</code>..<code>31</code>)</td>
</tr>
<tr>
<td><code>%f</code></td>
<td>Microseconds (<code>000000</code>..<code>999999</code>)</td>
</tr>
<tr>
<td><code>%H</code></td>
<td>Hour (<code>00</code>..<code>23</code>)</td>
</tr>
<tr>
<td><code>%h</code></td>
<td>Hour (<code>01</code>..<code>12</code>)</td>
</tr>
<tr>
<td><code>%I</code></td>
<td>Hour (<code>01</code>..<code>12</code>)</td>
</tr>
<tr>
<td><code>%i</code></td>
<td>Minutes, numeric (<code>00</code>..<code>59</code>)</td>
</tr>
<tr>
<td><code>%j</code></td>
<td>Day of year (<code>001</code>..<code>366</code>)</td>
</tr>
<tr>
<td><code>%k</code></td>
<td>Hour (<code>0</code>..<code>23</code>)</td>
</tr>
<tr>
<td><code>%l</code></td>
<td>Hour (<code>1</code>..<code>12</code>)</td>
</tr>
<tr>
<td><code>%M</code></td>
<td>Month name (<code>January</code>..<code>December</code>)</td>
</tr>
<tr>
<td><code>%m</code></td>
<td>Month, numeric (<code>00</code>..<code>12</code>)</td>
</tr>
<tr>
<td><code>%p</code></td>
<td><code>AM</code> or <code>PM</code></td>
</tr>
<tr>
<td><code>%r</code></td>
<td>Time, 12-hour (<code>hh:mm:ss</code> followed by                   <code>AM</code> or <code>PM</code>)</td>
</tr>
<tr>
<td><code>%S</code></td>
<td>Seconds (<code>00</code>..<code>59</code>)</td>
</tr>
<tr>
<td><code>%s</code></td>
<td>Seconds (<code>00</code>..<code>59</code>)</td>
</tr>
<tr>
<td><code>%T</code></td>
<td>Time, 24-hour (<code>hh:mm:ss</code>)</td>
</tr>
<tr>
<td><code>%U</code></td>
<td>Week (<code>00</code>..<code>53</code>), where Sunday is the                   first day of the week</td>
</tr>
<tr>
<td><code>%u</code></td>
<td>Week (<code>00</code>..<code>53</code>), where Monday is the                   first day of the week</td>
</tr>
<tr>
<td><code>%V</code></td>
<td>Week (<code>01</code>..<code>53</code>), where Sunday is the                   first day of the week; used with <code>%X</code></td>
</tr>
<tr>
<td><code>%v</code></td>
<td>Week (<code>01</code>..<code>53</code>), where Monday is the                   first day of the week; used with <code>%x</code></td>
</tr>
<tr>
<td><code>%W</code></td>
<td>Weekday name (<code>Sunday</code>..<code>Saturday</code>)</td>
</tr>
<tr>
<td><code>%w</code></td>
<td>Day of the week                   (<code>0</code>=Sunday..<code>6</code>=Saturday)</td>
</tr>
<tr>
<td><code>%X</code></td>
<td>Year for the week where Sunday is the first day of the week, numeric,                   four digits; used with <code>%V</code></td>
</tr>
<tr>
<td><code>%x</code></td>
<td>Year for the week, where Monday is the first day of the week, numeric,                   four digits; used with <code>%v</code></td>
</tr>
<tr>
<td><code>%Y</code></td>
<td>Year, numeric, four digits</td>
</tr>
<tr>
<td><code>%y</code></td>
<td>Year, numeric (two digits)</td>
</tr>
<tr>
<td><code>%%</code></td>
<td>A literal “<code>%</code>” character</td>
</tr>
<tr>
<td><code>%<em><code>x</code></em></code></td>
<td><em><code>x</code></em>, for any                   “<em><code>x</code></em>” not listed                   above</td>
</tr>
</table>
<p>Reference:</p>
<p>http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/date-function-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset MySQL Root Password in CentOS</title>
		<link>http://kwatog.com/blog/reset-mysql-root-password-in-centos/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reset-mysql-root-password-in-centos</link>
		<comments>http://kwatog.com/blog/reset-mysql-root-password-in-centos/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 15:06:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=264</guid>
		<description><![CDATA[&#8220;Senior moments&#8221; tends to occur more frequently these days. Sign that I&#8217;m getting old. And several times already, I forgot the root password of my MySQL installation. You can recover MySQL database server password with following five easy steps. Step # 1: Stop the MySQL server process. # /etc/init.d/mysqld stop Step # 2: Start the&#8230;]]></description>
			<content:encoded><![CDATA[<p>&#8220;Senior moments&#8221; tends to occur more frequently these days. Sign that I&#8217;m getting old. And several times already, I forgot the root password of my MySQL installation. </p>
<p>You can recover MySQL database server password with following five easy steps.<br />
<span id="more-264"></span><br />
<strong>Step # 1:</strong> Stop the MySQL server process.</p>
<p><code># /etc/init.d/mysqld stop</code></p>
<p><strong>Step # 2:</strong> Start the MySQL (mysqld) server/daemon process with the &#8211;skip-grant-tables option so that it will not prompt for password.</p>
<p><code># mysqld_safe --skip-grant-tables &#038;</code></p>
<p><strong>Step # 3:</strong> Connect to mysql server as the root user.<br />
<code># mysql -u root</code><br />
<strong>Step # 4: </strong>Setup new mysql root account password.<br />
<code><br />
mysql> use mysql;<br />
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';<br />
mysql> flush privileges;<br />
mysql> quit<br />
</code></p>
<p><strong>Step # 5:</strong> Exit and restart the MySQL server.<br />
<code># /etc/init.d/mysqld stop</code></p>
<p>Step # 6: Start MySQL server and test it<br />
# /etc/init.d/mysqld start<br />
# mysql -u root -p</p>
<p>The steps are basically the same when resetting the password in other linux flavors. I&#8217;m using the same steps in Ubuntu but with a slight difference in shell commands. </p>
<p>reference :<br />
<a href="http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html">http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/reset-mysql-root-password-in-centos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Oracle NVL Equivalent in MySQL</title>
		<link>http://kwatog.com/blog/mysql/oracle-nvl-equivalent-in-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=oracle-nvl-equivalent-in-mysql</link>
		<comments>http://kwatog.com/blog/mysql/oracle-nvl-equivalent-in-mysql/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 01:59:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[isnull]]></category>
		<category><![CDATA[nvl]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=204</guid>
		<description><![CDATA[Here&#8217;s the MySQL equivalent of Oracle&#8217;s NVL and MSSQL/Sybase&#8217;s ISNULL functions. Syntax IFNULL(expr1,expr2) Usage If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2. Take note that IFNULL() returns a numeric or string value, depending on the context in which it is used. I haven&#8217;t used it for other data types yet but&#8230;]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the MySQL equivalent of Oracle&#8217;s NVL and MSSQL/Sybase&#8217;s ISNULL functions.</p>
<h3>Syntax</h3>
<p><code><br />
IFNULL(expr1,expr2)<br />
</code></p>
<h3>Usage</h3>
<p>If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2. Take note that IFNULL() returns a numeric or string value, depending on the context in which it is used. I haven&#8217;t used it for other data types yet but I reckon it would have the same results. That is to return the same data type as that of expr1. Another important thing to remember is that expr1 and expr2 should have the same data type</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/mysql/oracle-nvl-equivalent-in-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL SEQUENCE Equivalent</title>
		<link>http://kwatog.com/blog/mysql/mysql-sequence-equivalent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-sequence-equivalent</link>
		<comments>http://kwatog.com/blog/mysql/mysql-sequence-equivalent/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 03:37:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[nextval]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[sequence]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=197</guid>
		<description><![CDATA[Most Oracle guys (and I heard PostgreSQL, too) will be missing sequence in MySQL. The nearest equivalent that MySQL has for this feature is the AUTO INCREMENT field. However, auto increment is sometimes not sufficient and time will come that you will be missing it. Case in point is the alpha-numeric auto-generated code. In Oracle,&#8230;]]></description>
			<content:encoded><![CDATA[<p>Most Oracle guys (and I heard PostgreSQL, too) will be missing sequence in MySQL. The nearest equivalent that MySQL has for this feature is the AUTO INCREMENT field. However, auto increment is sometimes not sufficient and time will come that you will be missing it. </p>
<p>Case in point is the alpha-numeric auto-generated code. In Oracle, it&#8217;s easy to generate AA123, AA124, AA125, etc., etc. All we have to do is concat the alpha part (AA) and with the nextval of sequence. For MySQL, the alpha part and the numeric part have to be saved in separate fields.</p>
<p>However, Maresa of Microshell has created an alternative solution for it. The article discusses a way to emulate the nextval function in mysql.  It a nutshell, they created a table similar to the all_sequences of Oracle. This is where you insert your sequences. Then, create a function named nextval() function which increments and returns value of the sequence.<br />
You can check the procedure <a href="http://www.microshell.com/database/mysql/emulating-nextval-function-to-get-sequence-in-mysql/1942">here</a>.</p>
<p>It&#8217;s pretty neat, actually. It&#8217;s an excellent alternative and you can even create similar functions like currval(), prevval(), among others. However, I have some reservations on his approach especially on the issue of concurrency. You see in Oracle, calling the nextval() will increment the value and that&#8217;s already persisted (saved) in the sequence table even without saving your query/dml statement. On this approach, other queries accessing the pseudo-nextval will have to wait until your query finishes. Not a good idea. </p>
<p>So for now, I&#8217;ll will still have to make do with whatever MySQL is providing. If there&#8217;s any consolation, MySQL provides LAST_INSERT_ID()  function in case you want to get the latest id inserted. See details here <a href="http://dev.mysql.com/doc/refman/5.0/en/information-functions.html">here</a>. </p>
<p>So I&#8217;m just hoping that MySQL will implement an equivalent feature in the near future. With the imminent takeover by Oracle, I&#8217;m actually hoping that development of MySQL will push through and take a steam. We all know that the development of this widely used open-source database engine has been hampered ever since Sun bought it. </p>
<p>Sequence is a little feature. But little as it seems, it solves a lot of problems and helps improve code development time.</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/mysql/mysql-sequence-equivalent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Administration Commands</title>
		<link>http://kwatog.com/blog/linux/mysql-admi-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-admi-linux</link>
		<comments>http://kwatog.com/blog/linux/mysql-admi-linux/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 12:11:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[create user]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=153</guid>
		<description><![CDATA[Backup MySQL Database into a File -bash-3.2$mysqldump -ujhondoe -p mydb_name > mydb_name_backup.sql password: -bash-3.2$ zip mydb_name_backup.zip mydb_name_backup.sql Load MySQL Backup Into Database -bash-3.2$mysql -ujhondoe mydb_name < mydb_name_backup.sql password: Create User in MySQL mysql> CREATE USER 'jhondoe'@'localhost' IDENTIFIED BY 'mypassword'; mysql> GRANT ALL PRIVILEGES ON mydbname.* TO 'jhondoe'@'localhost' WITH GRANT OPTION; mysql> CREATE USER 'jhondoe'@'%' IDENTIFIED&#8230;]]></description>
			<content:encoded><![CDATA[<h2>Backup MySQL Database into a File</h2>
<p><code><br />
-bash-3.2$mysqldump -ujhondoe -p mydb_name > mydb_name_backup.sql<br />
password: <type your password here><br />
-bash-3.2$ zip mydb_name_backup.zip mydb_name_backup.sql<br />
</code></p>
<h2>Load MySQL Backup Into Database</h2>
<p><code><br />
-bash-3.2$mysql -ujhondoe mydb_name < mydb_name_backup.sql<br />
password: <type your password here><br />
</code></p>
<h2>Create User in MySQL</h2>
<p><code><br />
mysql> CREATE USER 'jhondoe'@'localhost' IDENTIFIED BY 'mypassword';<br />
mysql> GRANT ALL PRIVILEGES ON mydbname.* TO 'jhondoe'@'localhost'   WITH GRANT OPTION;</p>
<p>mysql> CREATE USER 'jhondoe'@'%' IDENTIFIED BY 'mypassword';<br />
mysql> GRANT ALL PRIVILEGES ON mydbname.* TO 'monty'@'%'   WITH GRANT OPTION;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/linux/mysql-admi-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

