<?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>betweenGo &#187; MySQL</title>
	<atom:link href="http://betweengo.com/category/database/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://betweengo.com</link>
	<description>We make Ruby on Rails easy.  We make ATG easy.</description>
	<lastBuildDate>Tue, 08 May 2012 19:30:33 +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>&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate</title>
		<link>http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/</link>
		<comments>http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 16:24:56 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=169</guid>
		<description><![CDATA[When I run rake db:migrate I get this error at the end. Error in my_thread_global_end(): 1 threads didn't exit I pinned it down to this code in one of my migration files. # create admin user user = User.new user.login = 'admin' user.password = 'password' user.save(false) If I don&#8217;t run user.save(false) I don&#8217;t get the [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2008/10/09/rake-dbmigrate-hangs/' rel='bookmark' title='rake db:migrate hangs'>rake db:migrate hangs</a></li>
<li><a href='http://betweengo.com/2005/10/26/php-and-mysql-41/' rel='bookmark' title='Problem connecting to MySQL 4.1 via PHP'>Problem connecting to MySQL 4.1 via PHP</a></li>
<li><a href='http://betweengo.com/2008/02/12/upgrading-meetingkoreanscom-to-rails-126/' rel='bookmark' title='Upgrading MeetingKoreans.com to Rails 1.2.6'>Upgrading MeetingKoreans.com to Rails 1.2.6</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When I run rake db:migrate I get this error at the end.</p>
<pre>Error in my_thread_global_end(): 1 threads didn't exit</pre>
<p>I pinned it down to this code in one of my migration files.</p>
<pre># create admin user
user = User.new
user.login = 'admin'
user.password = 'password'
user.save(false)</pre>
<p>If I don&#8217;t run user.save(false) I don&#8217;t get the error.  I am not sure why, the user does get saved properly to the database.</p>
<p>I saw this post on the MySQL forums that seemed to <a title="MySQL Forums :: Newbie :: Error in my_thread_global_end(): 1 threads didn't exit" href="http://forums.mysql.com/read.php?10,153077,153234#msg-153234">indicate it was an issue with libmySQL.dll</a>.  So I upgraded my MySQL instance from 5.0.27 to 5.0.51a.  Of course this did not go smoothly, I got this error  when trying to reconfigure the MySQL server instance &#8220;MySQL service could not be started error 0&#8243;.  Fortunately another post on the MySQL forums, <a title="MySQL Forums :: Install :: Could not start service : Error 2003" href="http://forums.mysql.com/read.php?11,106123,106142#msg-106142">Could not start service : Error 2003</a>, solved this problem for me.  I just had to remove the following files from the mysql/data directory.</p>
<ul>
<li>ib_logfile0</li>
<li>ib_logfile1</li>
<li>ibdata1</li>
</ul>
<p>Unfortunately when I then did a rake db:migrate I saw this error.</p>
<pre>Mysql::Error: Table 'prayer.schema_info' doesn't exist:
SELECT version FROM schema_info</pre>
<p>After deleting and recreating the database I was finally able to run rake db:migrate.  Unfortunately I still got the same error that inspired this post.</p>
<p>Googling some more I saw a MySQL bug report, <a href="http://bugs.mysql.com/bug.php?id=25621">MySQL Bugs: #25621: Error in my_thread_global_end(): 1 threads didn&#8217;t exit</a>.  Apparently this is a client side issue and I think I can safely ignore it though it is quite annoying.</p>
<blockquote><p>Strictly speaking, this is not MySQL bug. This is a client bug &#8211; a client application (PHP, probably) linked with libmysqlclient calls my_thread_init() but does not call my_thread_end() as appropriate (doesn&#8217;t call at all or calls too late). MySQL client library detects this and issues a warning.</p>
<p>On the other hand, we can just remove the check and let buggy applications to fail some other way. Not calling my_thread_end() is a guaranteed memory leak. Calling it too late could easily crash the application.</p></blockquote>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2008%2F04%2F03%2Ferror-in-my_thread_global_end-when-running-rake-dbmigrate%2F&amp;title=%26%238216%3BError%20in%20my_thread_global_end%28%29%26%238217%3B%20when%20running%20rake%20db%3Amigrate" id="wpa2a_2"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2008/10/09/rake-dbmigrate-hangs/' rel='bookmark' title='rake db:migrate hangs'>rake db:migrate hangs</a></li>
<li><a href='http://betweengo.com/2005/10/26/php-and-mysql-41/' rel='bookmark' title='Problem connecting to MySQL 4.1 via PHP'>Problem connecting to MySQL 4.1 via PHP</a></li>
<li><a href='http://betweengo.com/2008/02/12/upgrading-meetingkoreanscom-to-rails-126/' rel='bookmark' title='Upgrading MeetingKoreans.com to Rails 1.2.6'>Upgrading MeetingKoreans.com to Rails 1.2.6</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Listing All Tables</title>
		<link>http://betweengo.com/2008/03/28/listing-all-tables/</link>
		<comments>http://betweengo.com/2008/03/28/listing-all-tables/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 19:43:23 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/database/oracle/2008/03/28/listing-all-tables/</guid>
		<description><![CDATA[With MySQL listing all the tables in a database is easy enough. mysql&#62; show tables; With Oracle it&#8217;s a little less straight-forward. &#62; select table_name from user_tables; OR &#62; select * from user_objects where object_type = 'TABLE'; OR &#62; select table_name from tabs; OR &#62; select table_name from all_all_tables; Related posts: Describing Tables and Constraints [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2006/11/21/howto-describe-a-table/' rel='bookmark' title='Describing Tables and Constraints in Oracle'>Describing Tables and Constraints in Oracle</a></li>
<li><a href='http://betweengo.com/2006/07/04/howto-view-tables-and-indexes-in-an-oracle-database/' rel='bookmark' title='HOWTO View Tables and Indexes in an Oracle Database'>HOWTO View Tables and Indexes in an Oracle Database</a></li>
<li><a href='http://betweengo.com/2007/12/07/retrieving-the-source-from-the-database/' rel='bookmark' title='Retrieving the Source from the Database'>Retrieving the Source from the Database</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>With MySQL listing all the tables in a database is easy enough.</p>
<pre>mysql&gt; show tables;</pre>
<p>With Oracle it&#8217;s a little less straight-forward.</p>
<pre>&gt; <span id="intelliTxt">select table_name from user_tables;</span><span id="intelliTxt"></span></pre>
<p>OR</p>
<pre>&gt; <span id="intelliTxt">select * from user_objects where object_type = 'TABLE'; </span></pre>
<p>OR</p>
<pre>&gt; select table_name from tabs;</pre>
<p>OR</p>
<pre>&gt; select table_name from all_all_tables;</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2008%2F03%2F28%2Flisting-all-tables%2F&amp;title=Listing%20All%20Tables" id="wpa2a_4"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2006/11/21/howto-describe-a-table/' rel='bookmark' title='Describing Tables and Constraints in Oracle'>Describing Tables and Constraints in Oracle</a></li>
<li><a href='http://betweengo.com/2006/07/04/howto-view-tables-and-indexes-in-an-oracle-database/' rel='bookmark' title='HOWTO View Tables and Indexes in an Oracle Database'>HOWTO View Tables and Indexes in an Oracle Database</a></li>
<li><a href='http://betweengo.com/2007/12/07/retrieving-the-source-from-the-database/' rel='bookmark' title='Retrieving the Source from the Database'>Retrieving the Source from the Database</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/03/28/listing-all-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin not starting</title>
		<link>http://betweengo.com/2008/03/05/phpmyadmin-not-starting/</link>
		<comments>http://betweengo.com/2008/03/05/phpmyadmin-not-starting/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 02:25:40 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://betweengo.com/database/mysql/2008/03/05/phpmyadmin-not-starting/</guid>
		<description><![CDATA[Today when I started up phpMyAdmin (version 2.10.0.2) by going to http://localhost/phpMyAdmin I saw this error screen. phpMyAdmin &#8211; Error I googled around but could not find any solutions. So I went and tried to install the latest version of phpMyAdmin, 2.11.5. When I tried to run setup I saw this error screen. phpMyAdmin &#8211; [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2007/01/26/hibernateexception-found-two-representations-of-same-collection/' rel='bookmark' title='HibernateException: Found two representations of same collection'>HibernateException: Found two representations of same collection</a></li>
<li><a href='http://betweengo.com/2008/05/06/apache-not-starting-because-of-skype/' rel='bookmark' title='Apache not starting because of Skype'>Apache not starting because of Skype</a></li>
<li><a href='http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/' rel='bookmark' title='&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate'>&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Today when I started up phpMyAdmin (version 2.10.0.2) by going to <a href="http://localhost/phpMyAdmin" title="phpMyAdmin">http://localhost/phpMyAdmin</a> I saw this error screen.</p>
<table border="1" bgColor="#ff0000" width="100%" cellPadding="3" borderColor="#ff0000">
<tr>
<td vAlign="middle"><font color="#ffffff"></p>
<h2>phpMyAdmin &#8211; Error</h2>
<p></font></td>
</tr>
</table>
<p>I googled around but could not find any solutions.</p>
<p>So I went and tried to install the latest version of phpMyAdmin, 2.11.5.  When I tried to run <a href="http://localhost/phpMyAdmin/scripts/setup.php">setup</a> I saw this error screen.</p>
<table border="1" bgColor="#ff0000" width="100%" cellPadding="3" borderColor="#ff0000">
<tr>
<td vAlign="middle"><font color="#ffffff"></p>
<h2>phpMyAdmin &#8211; Error</h2>
<p></font></td>
</tr>
<tr bgColor="#ffffff">
<td>Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.</td>
</tr>
</table>
<p>Now that I had an error message to work with I googled around and found this post, <a href="http://www.lost-in-code.com/25/xampp-phpmyadmin-problem/" title="Xampp phpMyAdmin Problem">Xampp phpMyAdmin Problem</a>, which helped me diagnose the problem.</p>
<p>It turns out during one of my cleaning sessions I wiped out the session directory in, &#8220;C:\DOCUME~1\fkim\LOCALS~1\Temp\php\session.&#8221;  After restoring it I ran into my next problem.</p>
<table border="1" bgColor="#ff0000" width="100%" cellPadding="3" borderColor="#ff0000">
<tr>
<td vAlign="middle"><font color="#ffffff"></p>
<h2>phpMyAdmin &#8211; Error</h2>
<p></font></td>
<td>Cannot load <a href="http://php.net/mysql" target="Documentation" title="PHP: MySQL"><em>mysql</em></a> extension. Please check your PHP configuration. &#8211; <a href="./Documentation.html#faqmysql" target="documentation" title="phpMyAdmin Documentation">Documentation</a></td>
</tr>
</table>
<p>I upgraded to PHP 5.2.5 from 5.2.1 but that did not help.  I installed the mbstring module but that did not help.</p>
<p>Finally I added the PHP extension directory to the path (I had already added the PHP directory to the path) and it finally worked!  My path now includes the following two directories, E:\Program Files\PHP and E:\Program Files\PHP\ext.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2008%2F03%2F05%2Fphpmyadmin-not-starting%2F&amp;title=phpMyAdmin%20not%20starting" id="wpa2a_6"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2007/01/26/hibernateexception-found-two-representations-of-same-collection/' rel='bookmark' title='HibernateException: Found two representations of same collection'>HibernateException: Found two representations of same collection</a></li>
<li><a href='http://betweengo.com/2008/05/06/apache-not-starting-because-of-skype/' rel='bookmark' title='Apache not starting because of Skype'>Apache not starting because of Skype</a></li>
<li><a href='http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/' rel='bookmark' title='&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate'>&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/03/05/phpmyadmin-not-starting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>View that Calculates using Previous Date</title>
		<link>http://betweengo.com/2008/03/03/view-that-calculates-using-most-recent-entry/</link>
		<comments>http://betweengo.com/2008/03/03/view-that-calculates-using-most-recent-entry/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 06:00:48 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://betweengo.com/database/mysql/2008/03/03/view-that-calculates-using-most-recent-entry/</guid>
		<description><![CDATA[I have a table of data that tracks the mileage of my beloved 2005 Toyota Prius. +----+------------+---------+---------+-------+ &#124; id &#124; date       &#124; mileage &#124; gallons &#124; cost  &#124; +----+------------+---------+---------+-------+ &#124;  1 &#124; 2005-02-14 &#124;     280 &#124;   8.615 &#124; 16.03 &#124; &#124;  2 &#124; 2005-02-27 &#124;     480 &#124;   4.775 &#124;  8.59 &#124; &#124;  3 &#124; 2005-03-19 [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2008/01/10/display-date-in-os-x-menu-bar/' rel='bookmark' title='Display Date in OS X Menu Bar'>Display Date in OS X Menu Bar</a></li>
<li><a href='http://betweengo.com/2007/11/17/date-and-timestamp-repository-data-types/' rel='bookmark' title='Date and Timestamp Repository Data Types'>Date and Timestamp Repository Data Types</a></li>
<li><a href='http://betweengo.com/2010/04/19/set-atg-repository-date-timestamp-properties-to-current-time/' rel='bookmark' title='Set ATG Repository Item Date or Timestamp Properties to the Current Time'>Set ATG Repository Item Date or Timestamp Properties to the Current Time</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have a table of data that tracks the mileage of my beloved <a href="http://www.toyota.com/prius" title="Toyota Prius">2005 Toyota Prius</a>.</p>
<pre>+----+------------+---------+---------+-------+
| id | date       | mileage | gallons | cost  |
+----+------------+---------+---------+-------+
|  1 | 2005-02-14 |     280 |   8.615 | 16.03 |
|  2 | 2005-02-27 |     480 |   4.775 |  8.59 |
|  3 | 2005-03-19 |     713 |   7.213 | 14.27 |
|  4 | 2005-04-09 |     999 |    7.86 | 16.81 |
|  5 | 2005-04-11 |    1172 |   3.174 |  6.63 |
|  6 | 2005-05-05 |    1560 |   8.889 | 18.66 |
|  7 | 2005-06-07 |    1985 |   9.815 | 20.01 |
|  8 | 2005-07-03 |    2444 |   9.868 |  21.7 |
|  9 | 2005-08-13 |    2762 |   7.728 |    20 |
| 10 | 2005-09-11 |    3271 |  10.072 | 30.11 |
| 11 | 2005-10-24 |    3646 |   8.953 | 22.19 |
| 12 | 2005-10-30 |    3959 |   6.583 | 17.11 |
| 13 | 2005-11-04 |    4184 |   4.538 | 11.25 |
| 14 | 2005-11-21 |    4631 |   8.742 |    18 |
| 15 | 2005-12-31 |    4897 |   8.511 | 18.64 |
| 16 | 2006-02-02 |    5609 |    7.83 |    18 |
| 17 | 2006-03-01 |    6064 |    3.38 |  7.16 |
| 18 | 2006-03-13 |    6400 |   7.171 |  16.2 |
| 19 | 2006-03-22 |    6605 |   5.399 | 13.17 |
| 22 | 2006-02-16 |    5944 |   7.957 |  17.5 |
| 20 | 2006-04-06 |    6974 |   7.774 | 19.43 |
| 21 | 2006-04-23 |    7316 |   7.102 | 20.45 |
+----+------------+---------+---------+-------+</pre>
<p>I wanted a way to calculate how many miles were driven for each trip, i.e. between consecutive dates, and what was the miles per gallon (MPG) for that trip.  To do this I modified what I learned in this post, <a href="http://forums.mysql.com/read.php?10,139333,139337#msg-139337" title="nique ID field, getting next and previous existing ID from table">unique ID field, getting next and previous existing ID from table</a> to create a view that does all these calculations.  The advantage of this view is that it does not matter what order I enter the data, it will always calculate correctly.</p>
<pre>CREATE VIEW v_prius_mpg AS
  SELECT id, date, mileage, gallons, cost, mileage as trip_mileage,
         mileage / gallons AS mpg, cost / gallons AS price_per_gallon
    FROM prius_mpg
    WHERE id = 1
  UNION
  SELECT New.id AS id, New.date, New.mileage, New.gallons, New.cost,
        (New.mileage - Old.mileage) AS trip_mileage,
        (New.mileage - Old.mileage)/ New.gallons AS mpg,
        (New.cost / New.gallons) AS price_per_gallon
    FROM prius_mpg New, prius_mpg Old
    WHERE New.id &gt; 1
      AND Old.id =
        (SELECT id
           FROM prius_mpg
           WHERE date &lt; New.date
           ORDER BY date DESC
           LIMIT 1);</pre>
<p>And here are the results of the view.  Note how row 20 is out of order but it still calculates correctly the trip mileage and MPG.</p>
<pre>+----+------------+---------+---------+--------------+------------------+
| id | date       | mileage | gallons | trip_mileage | mpg              |
+----+------------+---------+---------+--------------+------------------+
|  1 | 2005-02-14 |     280 |   8.615 |          280 |  32.501450957632 |
|  2 | 2005-02-27 |     480 |   4.775 |          200 | 41.8848167539267 |
|  3 | 2005-03-19 |     713 |   7.213 |          233 | 32.3027866352419 |
|  4 | 2005-04-09 |     999 |    7.86 |          286 | 36.3867684478371 |
|  5 | 2005-04-11 |    1172 |   3.174 |          173 | 54.5053560176434 |
|  6 | 2005-05-05 |    1560 |   8.889 |          388 | 43.6494543818202 |
|  7 | 2005-06-07 |    1985 |   9.815 |          425 |  43.301069791136 |
|  8 | 2005-07-03 |    2444 |   9.868 |          459 | 46.5139845966761 |
|  9 | 2005-08-13 |    2762 |   7.728 |          318 | 41.1490683229814 |
| 10 | 2005-09-11 |    3271 |  10.072 |          509 | 50.5361397934869 |
| 11 | 2005-10-24 |    3646 |   8.953 |          375 | 41.8854015413828 |
| 12 | 2005-10-30 |    3959 |   6.583 |          313 | 47.5467112258849 |
| 13 | 2005-11-04 |    4184 |   4.538 |          225 | 49.5813133539004 |
| 14 | 2005-11-21 |    4631 |   8.742 |          447 | 51.1324639670556 |
| 15 | 2005-12-31 |    4897 |   8.511 |          266 | 31.2536717189519 |
| 16 | 2006-02-02 |    5609 |    7.83 |          712 | 90.9323116219668 |
| 17 | 2006-03-01 |    6064 |    3.38 |          120 | 35.5029585798817 |
| 18 | 2006-03-13 |    6400 |   7.171 |          336 | 46.8553897643285 |
| 19 | 2006-03-22 |    6605 |   5.399 |          205 | 37.9699944434154 |
| 20 | 2006-02-16 |    5944 |   7.957 |          335 | 42.1012944577102 |
| 21 | 2006-04-06 |    6974 |   7.774 |          369 |  47.465912014407 |
| 22 | 2006-04-23 |    7316 |   7.102 |          342 | 48.1554491692481 |
+----+------------+---------+---------+--------------+------------------+</pre>
<p>I always wanted to appear on every row how many gallons of gas had been consumed up to that day and how much had spent on gas up to date but I could not figure out how.  The only thing I could do was determine the sums up until now.</p>
<pre>mysql&gt; select sum(gallons) as gallons_to_date,
       sum(cost) as cost_to_date from prius_mpg where date &lt;= current_date;
+-----------------+--------------+
| gallons_to_date | cost_to_date |
+-----------------+--------------+
|         161.949 |       371.91 |
+-----------------+--------------+
1 row in set (0.01 sec)</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2008%2F03%2F03%2Fview-that-calculates-using-most-recent-entry%2F&amp;title=View%20that%20Calculates%20using%20Previous%20Date" id="wpa2a_8"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2008/01/10/display-date-in-os-x-menu-bar/' rel='bookmark' title='Display Date in OS X Menu Bar'>Display Date in OS X Menu Bar</a></li>
<li><a href='http://betweengo.com/2007/11/17/date-and-timestamp-repository-data-types/' rel='bookmark' title='Date and Timestamp Repository Data Types'>Date and Timestamp Repository Data Types</a></li>
<li><a href='http://betweengo.com/2010/04/19/set-atg-repository-date-timestamp-properties-to-current-time/' rel='bookmark' title='Set ATG Repository Item Date or Timestamp Properties to the Current Time'>Set ATG Repository Item Date or Timestamp Properties to the Current Time</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/03/03/view-that-calculates-using-most-recent-entry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysqlimport</title>
		<link>http://betweengo.com/2006/03/19/mysqlimport/</link>
		<comments>http://betweengo.com/2006/03/19/mysqlimport/#comments</comments>
		<pubDate>Sun, 19 Mar 2006 22:26:10 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://betweengo.com/uncategorized/2006/03/19/mysqlimport/</guid>
		<description><![CDATA[MySQL provides a utility for importing text files into a database called mysqlimport. It has some nice features including: If you don&#8217;t include the ID in the data of the text file and your table is set up to auto-increment the ID then it will create the ID for you when importing the data. It [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2005/07/28/user-defined-property-type-gotchas/' rel='bookmark' title='user-defined property type gotcha&#8217;s'>user-defined property type gotcha&#8217;s</a></li>
<li><a href='http://betweengo.com/2007/11/17/date-and-timestamp-repository-data-types/' rel='bookmark' title='Date and Timestamp Repository Data Types'>Date and Timestamp Repository Data Types</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>MySQL provides a utility for importing text files into a database called <a href="http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html">mysqlimport</a>.  It has some nice features including:</p>
<ol>
<li>If you don&#8217;t include the ID in the data of the text file and your table is set up to auto-increment the ID then it will create the ID for you when importing the data.</li>
<li>It recognizes different delimiters for the data, the common delimiters being tabs and commas.</li>
<li>It will delete previous data.</li>
</ol>
<p>An example of how to use it is:<br />
<code>mysqlimport --user=admin --password=admin --local --delete --verbose -c name,pos,age,b,tm,rel,dl,ab,r,h,d,t,hr,rbi,bb,k,sb,cs,'$$' --fields -terminated-by='\t' roto batters.txt</code></p>
<p>Note how in this example that the tab delimiter is specified by &#8216;\t&#8217;.  Also special column names must be enclosed within quotes like &#8216;$$&#8217;.  And finally the name of the text file you are using <em>must</em> be the same as the name of the table in which you are importing.</p>
<p>One frustrating thing about mysqlimport is that if there are warnings or errors during import it does not actually tell you what the errors are.  mysqlimport does not have a problem with no data being present where it expects there to be some, for example in a comma delimited file if it sees ,, it just assumes that column should be blank or 0, depending on the data type.</p>
<p>However mysqlimport will count as a warning if it sees more data fields then you specified in the number of columns.  This could happen because you forgot to specify a column or it could happen because your data has empty spaces at the end of the line.</p>
<p>To debug these warnings or errors what I do is import smaller sets of the data at a time to try to discover what is causing the problem.  Usually the same pattern is causing the warning so once you discover what is the problem you can eliminate it from throughout the text file.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2006%2F03%2F19%2Fmysqlimport%2F&amp;title=mysqlimport" id="wpa2a_10"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2005/07/28/user-defined-property-type-gotchas/' rel='bookmark' title='user-defined property type gotcha&#8217;s'>user-defined property type gotcha&#8217;s</a></li>
<li><a href='http://betweengo.com/2007/11/17/date-and-timestamp-repository-data-types/' rel='bookmark' title='Date and Timestamp Repository Data Types'>Date and Timestamp Repository Data Types</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2006/03/19/mysqlimport/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Problem connecting to MySQL 4.1 via PHP</title>
		<link>http://betweengo.com/2005/10/26/php-and-mysql-41/</link>
		<comments>http://betweengo.com/2005/10/26/php-and-mysql-41/#comments</comments>
		<pubDate>Thu, 27 Oct 2005 03:00:54 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://betweengo.com/miscellaneous/2005/10/26/php-and-mysql-41/</guid>
		<description><![CDATA[After installing MySQL 4.1 I was unable to connect to the MySQL database via PHP. It turns out this was because I set the root password. I tried instructing MySQL to use the old password encryption method by adding these two lines to my.ini but that did not work. #Use old password encryption method (needed [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/' rel='bookmark' title='&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate'>&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate</a></li>
<li><a href='http://betweengo.com/2008/04/02/problem-updating-restful_authentication-plugin/' rel='bookmark' title='Problem updating restful_authentication plugin'>Problem updating restful_authentication plugin</a></li>
<li><a href='http://betweengo.com/2006/03/19/mysqlimport/' rel='bookmark' title='mysqlimport'>mysqlimport</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>After installing MySQL 4.1 I was unable to connect to the MySQL database via PHP. It turns out this was because I set the root password. I tried instructing MySQL to use the old password encryption method by adding these two lines to my.ini but that did not work.</p>
<p>#Use old password encryption method (needed for 4.0 and older clients).<br />
old_passwords</p>
<p>Finally I just uninstalled MySQL 4.1 and reinstalled it without the root password. After doing that everything was fine.</p>
<p>Also I noticed when I uninstalled MySQL 4.0 it did not remove the service. When I installed MySQL 4.1 it complained about the Windows service&#8221;MySQL&#8221; already being there so I had to install the Windows service &#8220;MySQL41&#8243;. Then I uninstalled MySQL 4.1 due to the above issue and it removed the &#8220;MySQL41&#8243; service.</p>
<p>When I installed the second time it thought I was trying to reconfigure the &#8220;MySQL&#8221; service. I instructed the installer to remove the &#8220;MySQL&#8221; service. Then I uninstalled and reinstalled a third time and this time I was able to install the Windows service &#8220;MySQL41&#8243; properly.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2005%2F10%2F26%2Fphp-and-mysql-41%2F&amp;title=Problem%20connecting%20to%20MySQL%204.1%20via%20PHP" id="wpa2a_12"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2008/04/03/error-in-my_thread_global_end-when-running-rake-dbmigrate/' rel='bookmark' title='&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate'>&#8216;Error in my_thread_global_end()&#8217; when running rake db:migrate</a></li>
<li><a href='http://betweengo.com/2008/04/02/problem-updating-restful_authentication-plugin/' rel='bookmark' title='Problem updating restful_authentication plugin'>Problem updating restful_authentication plugin</a></li>
<li><a href='http://betweengo.com/2006/03/19/mysqlimport/' rel='bookmark' title='mysqlimport'>mysqlimport</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2005/10/26/php-and-mysql-41/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! -->
