<?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>Sébastien Barbieri's blog &#187; tunnel</title>
	<atom:link href="http://blog.sbw.be/tag/tunnel/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sbw.be</link>
	<description>My life, my work, my projects</description>
	<lastBuildDate>Sat, 24 Dec 2011 00:12:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Clean and efficient mysql ssh tunneling (on linux)</title>
		<link>http://blog.sbw.be/2009/03/31/clean-and-efficient-mysql-ssh-tunneling-on-linux/</link>
		<comments>http://blog.sbw.be/2009/03/31/clean-and-efficient-mysql-ssh-tunneling-on-linux/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 13:00:52 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2009/03/31/clean-and-efficient-mysql-ssh-tunneling-on-linux/</guid>
		<description><![CDATA[ssh -L 3307:localhost:3306 &#60;user&#62;@&#60;remotehost&#62; -f sleep 10; mysql -u &#60;mysqluser&#62; -p -P3307 -h 127.0.0.1 ssh -L 3307:localhost:3306 &#8211;> create a 3307 listening port locally that will be forwarded to a 3306 port on the other end of the ssh tunnel &#60;user&#62;@&#60;remotehost&#62; &#8211;> user allow to connect via ssh on the remote host -f &#8211;> go [...]]]></description>
			<content:encoded><![CDATA[<p><strong>ssh -L 3307:localhost:3306 &lt;user&gt;@&lt;remotehost&gt; -f sleep 10; mysql -u &lt;mysqluser&gt; -p -P3307 -h 127.0.0.1</strong></p>
<ul>
<li><strong>ssh -L 3307:localhost:3306</strong> &#8211;> create a 3307 listening port locally that will be forwarded to a 3306 port on the other end of the ssh tunnel</li>
<li><strong>&lt;user&gt;@&lt;remotehost&gt;</strong> &#8211;> user allow to connect via ssh on the remote host</li>
<li><strong>-f</strong> &#8211;> go in background</li>
<li><strong>sleep 10</strong> &#8211;> will execute the sleep 10 command (sleep 10 sec) on the remote host ans then close &#8230; unless the tunnel is in use (and a child proc is created) which is the case with the final</li>
<li><strong>; mysql -u &lt;mysqluser&gt; -p -P3307 -h 127.0.0.1</strong> &#8211;> mysql connecto with user &lt;mysqluser&gt; via port 3307 on the localhost BUT passing by TCP (&#8217;127.0.0.1&#8242;) instead of named pipe (when using &#8216;localhost&#8217;) </li>
</ul>
<p>Pay attention to the 127.0.0.1 especially when you have this kind of error:<br />
<strong>ERROR 2002 (HY000): Can&#8217;t connect to local MySQL server through socket &#8216;/var/run/mysqld/mysqld.sock&#8217; (2)</strong></p>
<p>References:</p>
<ul>
<li>
<a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/">http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/</a>
</li>
<li>
<p>http://highspeedrails.com/Support/Howto/sshTunnelHowto</p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2009/03/31/clean-and-efficient-mysql-ssh-tunneling-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

