<?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>Developers, Developers, Developers! &#187; MySQL</title>
	<atom:link href="http://maksim.sorokin.dk/it/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://maksim.sorokin.dk/it</link>
	<description>Maksim Sorokin IT Blog</description>
	<lastBuildDate>Sun, 05 Feb 2012 19:37:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>MySQL Connecting Remotely</title>
		<link>http://maksim.sorokin.dk/it/2010/08/10/mysql-connecting-remotely/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/10/mysql-connecting-remotely/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 15:08:19 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=312</guid>
		<description><![CDATA[Information on the internet about remotely to the MySQL database is quite confusing. All over the place you may find information about bind-address configuraiton in the my.ini file. Even I wrote about it recentlyHowever, after setting bind-address option it will no longer be possible to connect to MySQL database from localhost. The guys from freenode [...]]]></description>
			<content:encoded><![CDATA[<p>Information on the internet about remotely to the MySQL database is quite confusing. All over the place you may find information about <code>bind-address</code> configuraiton in the <code>my.ini</code> file. Even I wrote about it <a href="http://maksim.sorokin.dk/it/2010/07/19/accessing-mysql-remotely/">recently</a>However, after setting <code>bind-address</code> option it will no longer be possible to connect to MySQL database from localhost.</p>
<p>The guys from <a href="http://freenode.net/">freenode</a> IRC server #mysql channel clarified the situation:</p>
<p><code>remove bind-address= and skip-networking from my.cnf and grant permission to the external 'user'@'host' and remove any firewall rules blocking port 3306 and make sure no overrides on the mysqld commandline. See  <a href="http://hashmysql.org/index.php?title=Remote_Clients_Cannot_Connect">http://hashmysql.org/index.php?title=Remote_Clients_Cannot_Connect</a><br />
</code><br />
<code><br />
bind-address is exclusive, not inclusive, it limits mysql server to what interface to listen on for incoming connections<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/10/mysql-connecting-remotely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Other Way to Import Data to MySQL</title>
		<link>http://maksim.sorokin.dk/it/2010/07/22/other-way-to-import-data-to-mysql/</link>
		<comments>http://maksim.sorokin.dk/it/2010/07/22/other-way-to-import-data-to-mysql/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 10:38:51 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=289</guid>
		<description><![CDATA[What to do, if SQL file for some reason has an error in the middle and it is big enough to have problems opening it with text editor. If you can live without that small piece of data, which causes you problems, then here a way to import all valid data from SQL file to [...]]]></description>
			<content:encoded><![CDATA[<p>What to do, if SQL file for some reason has an error in the middle and it is big enough to have problems opening it with text editor. If you <em>can</em> live without that small piece of data, which causes you problems, then here a way to import all <em>valid</em> data from SQL file to the database.</p>
<p>Imagine, you have <span id="more-289"></span>a table:</p>
<pre class="brush: plain; title: ;">
mysql&gt; describe test_table;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| val   | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
</pre>
<p>And you have following SQL script with an error in the middle:</p>
<pre class="brush: plain; title: ;">
insert into test_table (val) values (1);
insert into test_table (val) values (2a);
insert into test_table (val) values (3);
</pre>
<p>Traditionally, you would use the following way to import data:</p>
<pre class="brush: plain; title: ;">
mah@mah-laptop:~/Desktop$ mysql -u username db -p &lt; data.sql
Enter password:
ERROR 1054 (42S22) at line 2: Unknown column &#039;2a&#039; in &#039;field list&#039;
</pre>
<p>And in this case, <code>test_table</code> would contain only the data up to the failing line:</p>
<pre class="brush: plain; title: ;">
mysql&gt; select * from test_table;
+------+
| val  |
+------+
|    1 |
+------+
1 row in set (0.02 sec)
</pre>
<p>Another way to import data is through MySQL <a href="http://dev.mysql.com/doc/refman/5.0/en/batch-commands.html">source</a> command:</p>
<pre class="brush: plain; title: ;">
mysql&gt; source /home/mah/Desktop/datasql
Query OK, 1 row affected (0.00 sec)

ERROR 1054 (42S22): Unknown column '2a' in 'field list'
Query OK, 1 row affected (0.00 sec)
</pre>
<p>And in this case all valid statements will be executed:</p>
<pre class="brush: plain; title: ;">
mysql&gt; select * from test_table;
+------+
| val  |
+------+
|    1 |
|    3 |
+------+
2 rows in set (0.00 sec)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/07/22/other-way-to-import-data-to-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing MySQL Remotely</title>
		<link>http://maksim.sorokin.dk/it/2010/07/19/accessing-mysql-remotely/</link>
		<comments>http://maksim.sorokin.dk/it/2010/07/19/accessing-mysql-remotely/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 20:49:21 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=284</guid>
		<description><![CDATA[By default, you can access MySQL only from the localhost. In order to access it from the network, you have to modify your my.cfg or my.ini: Remove or comment out skip-networking option (by default in latest versions of MySQL this version is not present in configuration file) add (or modify) bind-address with ip of your [...]]]></description>
			<content:encoded><![CDATA[<p>By default, you can access MySQL only from the localhost. In order to access it from the network, you have to modify your <code>my.cfg</code> or <code>my.ini</code>:</p>
<ul>
<li>Remove or comment out <code>skip-networking</code> option (by default in latest versions of MySQL this version is not present in configuration file)</li>
<li>add (or modify) <code>bind-address</code> with ip of your machine on which MySQL is running</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/07/19/accessing-mysql-remotely/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Haskell and MySQL</title>
		<link>http://maksim.sorokin.dk/it/2010/04/24/haskell-and-mysql/</link>
		<comments>http://maksim.sorokin.dk/it/2010/04/24/haskell-and-mysql/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 09:38:48 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=154</guid>
		<description><![CDATA[In this post I will describe how to connect and use MySQL with Haskell. In this example we will use Ubuntu machine. We will use MySQL driver for HDBC from HackageDB. First, we need to install MySQL server: sudo apt-get install mysql-server Then we need MySQL client library: sudo apt-get install libmysqlclient-dev Then, we install [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will describe how to connect and use MySQL with Haskell.<span id="more-154"></span></p>
<p>In this example we will use Ubuntu machine. We will use <a href="http://hackage.haskell.org/package/HDBC-mysql">MySQL driver for HDBC</a> from HackageDB.</p>
<p>First, we need to install MySQL server:</p>
<pre class="brush: plain; title: ;">sudo apt-get install mysql-server</pre>
<p>Then we need MySQL client library:</p>
<pre class="brush: plain; title: ;">sudo apt-get install libmysqlclient-dev</pre>
<p>Then, we install <a href="http://hackage.haskell.org/package/HDBC-mysql">HDBC MySQL driver</a> using <a href="http://www.haskell.org/cabal/">Cabal</a>:</p>
<pre class="brush: plain; title: ;">http://hackage.haskell.org/package/HDBC-mysql</pre>
<p>And you are ready to write some code!</p>
<pre class="brush: plain; title: ;">
module DatabaseTest where

import Database.HDBC
import Database.HDBC.MySQL

main =
   do conn &lt;- connectMySQL defaultMySQLConnectInfo {
                  mysqlHost = &quot;localhost&quot;,
                  mysqlDatabase = &quot;db&quot;,
                  mysqlUser = &quot;user&quot;,
                  mysqlPassword = &quot;pass&quot;,
                  mysqlUnixSocket = &quot;/var/run/mysqld/mysqld.sock&quot; }
      quickQuery conn &quot;INSERT INTO test VALUES (1)&quot; []
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/04/24/haskell-and-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Silent Installation</title>
		<link>http://maksim.sorokin.dk/it/2010/04/21/mysql-silent-installation/</link>
		<comments>http://maksim.sorokin.dk/it/2010/04/21/mysql-silent-installation/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 16:15:54 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=143</guid>
		<description><![CDATA[Here is a bat file example: echo off cls echo Starting MySQL mysql-essential-5.0.88-win32 install msiexec /i &#34;mysql-essential-5.0.88-win32&#34; /qn INSTALLDIR=&#34;C:\Program Files\MySQL&#34; /L* &#34;C:\Program Files\MySQL\mysql-log.txt&#34; echo MySQL mysql-essential-5.0.88-win32 installed successfully echo Creating MySQL Windows service &#34;C:\Program Files\MySQL\bin\mysqlinstanceconfig.exe&#34; -i -q ServiceName=&#34;MySQL service&#34; RootPassword=&#34;newRootPassword&#34; ServerType=SERVER DatabaseType=MYISAM Port=3306 RootCurrentPassword=mysql echo MySQL Instance Configured. Service started. Which can be conveniently parametrized [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a bat file example:<br />
<span id="more-143"></span></p>
<pre class="brush: plain; title: ;">
echo off
cls

echo Starting MySQL mysql-essential-5.0.88-win32 install
msiexec /i &quot;mysql-essential-5.0.88-win32&quot; /qn INSTALLDIR=&quot;C:\Program Files\MySQL&quot; /L* &quot;C:\Program Files\MySQL\mysql-log.txt&quot;
echo MySQL mysql-essential-5.0.88-win32 installed successfully

echo Creating MySQL Windows service
&quot;C:\Program Files\MySQL\bin\mysqlinstanceconfig.exe&quot; -i -q ServiceName=&quot;MySQL service&quot; RootPassword=&quot;newRootPassword&quot; ServerType=SERVER DatabaseType=MYISAM Port=3306 RootCurrentPassword=mysql
echo MySQL Instance Configured. Service started.
</pre>
<p>Which can be conveniently parametrized with your installation packager, for example:</p>
<pre class="brush: plain; title: ;">
echo off
cls

echo Starting MySQL ${mysql-msi} install
msiexec /i &quot;${mysql-msi}&quot; /qn INSTALLDIR=&quot;${INSTALL_PATH}\${mysql-dir}&quot; /L* &quot;${INSTALL_PATH}\mysql-log.txt&quot;
echo MySQL ${mysql-msi} installed successfully

echo Creating MySQL Windows service
&quot;${INSTALL_PATH}\${mysql-dir}\bin\mysqlinstanceconfig.exe&quot; -i -q ServiceName=&quot;${mysql-service-name}&quot; RootPassword=&quot;${mysql-password}&quot; ServerType=SERVER DatabaseType=MYISAM Port=3306 RootCurrentPassword=mysql
echo MySQL Instance Configured. Service started.
</pre>
<p>But do not forget that if you want to ship MySQL with your product, you have to have an official permission from MySQL. Another option would be to ask user to download executable and provide a location to it int your installer.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/04/21/mysql-silent-installation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

