<?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>I can has weblog? &#187; MySQL</title>
	<atom:link href="http://justin-hopkins.com/blog/category/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://justin-hopkins.com/blog</link>
	<description>The thoughts and works of Justin Hopkins.</description>
	<lastBuildDate>Mon, 13 Sep 2010 15:49:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL Shutdown Problem During Upgrade to Ubuntu 9.10 (Karmic Koala)</title>
		<link>http://justin-hopkins.com/blog/2009/11/02/mysql-shutdown-problem-during-upgrade-to-ubuntu-9-10-karmic-koala</link>
		<comments>http://justin-hopkins.com/blog/2009/11/02/mysql-shutdown-problem-during-upgrade-to-ubuntu-9-10-karmic-koala#comments</comments>
		<pubDate>Mon, 02 Nov 2009 15:49:14 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://justin-hopkins.com/blog/2009/11/02/mysql-shutdown-problem-during-upgrade-to-ubuntu-9-10-karmic-koala</guid>
		<description><![CDATA[Immediately following the download of new packages for the upgrade to Karmic Koala, I noticed it had hung up while attempting to turn off services which were going to be upgraded. &#60;pre&#62; mysql stopping... &#60;/pre&#62; It &#8230; <a class="more-link" href="http://justin-hopkins.com/blog/2009/11/02/mysql-shutdown-problem-during-upgrade-to-ubuntu-9-10-karmic-koala">More<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Immediately following the download of new packages for the upgrade to Karmic Koala, I noticed it had hung up while attempting to turn off services which were going to be upgraded.</p>

<p><pre><code>
&lt;pre&gt;
mysql stopping...
&lt;/pre&gt;
</code></pre></p>

<p>It happened that MySQL was the hold up, and because killing the upgrade process seemed like a risky operation &#8211; I needed to find a way to move it along.</p>

<p>I wasn&#8217;t able to turn up any other posts from the community about this issue &#8211; so I decided to take the usual approach: <strong>Start killing process with fingers crossed and blog the outcome!</strong></p>

<p>Just so happens I nailed it on the first try:<br />
<pre><code>
&lt;pre&gt;
$ ps aux | grep mysql
&lt;snip /&gt;
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3624&nbsp;&nbsp;0.0&nbsp;&nbsp;0.0&nbsp;&nbsp; 5452&nbsp;&nbsp;1744 pts/7&nbsp;&nbsp;&nbsp;&nbsp;S+&nbsp;&nbsp; 09:05&nbsp;&nbsp; 0:00 /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf shutdown

$ sudo kill -9 3624 #your pid would be different...
&lt;/pre&gt;
</code></pre></p>

<p>The upgrader picked up and moved right along at that point. Hurray!</p>]]></content:encoded>
			<wfw:commentRss>http://justin-hopkins.com/blog/2009/11/02/mysql-shutdown-problem-during-upgrade-to-ubuntu-9-10-karmic-koala/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To: Export and Import of .csv data out of and into MySQL</title>
		<link>http://justin-hopkins.com/blog/2009/08/04/how-to-export-and-import-of-csv-data-out-of-and-into-mysql</link>
		<comments>http://justin-hopkins.com/blog/2009/08/04/how-to-export-and-import-of-csv-data-out-of-and-into-mysql#comments</comments>
		<pubDate>Tue, 04 Aug 2009 17:08:09 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://justin-hopkins.com/blog/?p=197</guid>
		<description><![CDATA[I keep having to do this, and have just got tired of Googling every time for it. Here is the method I use for pulling a table out of MySQL then putting it back later. It &#8230; <a class="more-link" href="http://justin-hopkins.com/blog/2009/08/04/how-to-export-and-import-of-csv-data-out-of-and-into-mysql">More<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I keep having to do this, and have just got tired of Googling every time for it. Here is the method I use for pulling a table out of MySQL then putting it back later. It may not work for versions of MySQL other than 5, but hey, it works for me. <strong>Why do this?</strong> Because it&#8217;s a great way to schlep off work to others who don&#8217;t know MySQL. Rather than having folks submit changes to me, I like to just dump it out to a .csv, have them open it in Excel, make their changes, re-save as .csv, then I can import it at my leisure. I sometimes like to throw flour on my face (like in the old rice crispies commercial) and come out of my cube saying &#8216;Whew, that took forever! Next time tell them it&#8217;s going to take a couple weeks&#8230;&#8217;</p>

<h3>Exporting the MySQL data into a comma delimited (.csv) file</h3>

<p><code>SELECT * INTO OUTFILE '/var/tmp/data.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '&quot;' LINES TERMINATED BY '\n' FROM tblWhatever;</code></p>

<p>This will dump your table into a file with each row from the database being on it&#8217;s own line, columns separated by commas, and if there are any spaces or funny business going on with the data in a field, the data will be enclosed in double quotes. You can make changes to this if you like by, for instance, substituting &#8216;,&#8217; with &#8216;\t&#8217; would result in a tab delmited file.</p>

<p><strong>some things:</strong> The reason I put the file into /var/tmp is because you need to put the file in a place that MySQL can write to. Put it wherever you want though. Also, your system may not use /var/tmp but /tmp or who knows what else. If you are using shared hosting, and are working with sensitive data &#8211; don&#8217;t do anything dumb like export credit card numbers to /tmp and then leave them there ;)</p>

<h3>Importing the comma delimited (.csv) file back into MySQL</h3>

<p>First thing, you&#8217;ll need to clear out your old table (otherwise the keys would collide):</p>

<p><code>DELETE FROM tblWhatever;</code></p>

<p>Then you can proceed with the import:</p>

<p><code>LOAD DATA INFILE '/home/youruser/data.csv' INTO TABLE tblWhatever FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '&quot;' LINES TERMINATED BY '\n';</code></p>

<p><strong>some things:</strong> Naturally the file will need to be readable by MySQL, but it can be anywhere. Older versions of MySQL used &#8216;LOAD <span class="caps">DATA LOCAL INFILE&#8217; </span>but MySQL5 uses just &#8216;LOAD <span class="caps">DATA INFILE&#8217; </span>and only accepts local files (a pretty good thing). So yeah you&#8217;ll have to scp your file to and fro.</p>]]></content:encoded>
			<wfw:commentRss>http://justin-hopkins.com/blog/2009/08/04/how-to-export-and-import-of-csv-data-out-of-and-into-mysql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

