<?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>bind-address &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/bind-address/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Sat, 07 Nov 2020 15:29:19 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>bind-address &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Java 連結遠端 MySQL</title>
		<link>https://noter.tw/1988/java%e9%80%a3%e7%b5%90%e9%81%a0%e7%ab%afmysql/</link>
					<comments>https://noter.tw/1988/java%e9%80%a3%e7%b5%90%e9%81%a0%e7%ab%afmysql/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Mon, 06 Feb 2012 14:28:25 +0000</pubDate>
				<category><![CDATA[資料庫]]></category>
		<category><![CDATA[一般程式]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[bind-address]]></category>
		<category><![CDATA[connector]]></category>
		<category><![CDATA[java.net.ConnectException]]></category>
		<category><![CDATA[jdbc]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=1988</guid>

					<description><![CDATA[<p>昨天小蛙在我的股票精算師中加入了股票代號查詢的方法，找來找去找到證交所有提供相關資料，總共有三個頁面，且頁面非常龐大，光是把頁面全部開啟就要花近五秒以上，更別說 Android Phone 查詢時的等&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/1988/java%e9%80%a3%e7%b5%90%e9%81%a0%e7%ab%afmysql/" data-wpel-link="internal">Java 連結遠端 MySQL</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>昨天小蛙在我的<strong><span style="color: #ff0000;">股票精算師</span></strong>中加入了股票代號查詢的方法，找來找去找到證交所有提供相關資料，總共有三個頁面，且頁面非常龐大，光是把頁面全部開啟就要花近<strong>五</strong>秒以上，更別說 Android Phone 查詢時的等待時間了，於是小蛙把證交所這些文件 Crawler 出來存在蛙齋的 MySQL，從 Android Phone上透過 <span style="color: #ff0000;"><strong>RESTful Service </strong></span>做查詢動作。從本機的Crawler爬取證交所的資料後，把資料整理好存入蛙齋的 MySQL 時發生<span style="color: #ff0000;"><strong>沒辦法連結到遠端 MySQL </strong></span>的問題，這篇文章記錄小蛙的解決方法。<span id="more-1988"></span>其實之前小蛙已經寫過 <a href="https://noter.tw/2883/java-%e9%80%a3%e7%b5%90-mysql/" target="_blank" rel="noopener noreferrer" data-wpel-link="internal">Java 連結 MySQL 的方法</a>，今天要連結的時候去看了一下(平常使用 Oracle 比較多，有時候真的要記錄一下&gt;&lt;，或是自己包好 API 直接可以用)，竟然沒有辦法連線，錯誤訊息是</p>
<div>
<div id="highlighter_564414" class="syntaxhighlighter  text">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="text plain">com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:</code></div>
<div class="line number2 index1 alt1"><code class="text plain">java.net.ConnectException: Connection refused: connect</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>原本覺得是沒有辦法透過root遠端的問題，新增了一個使用者，由於只是要新增、刪除、修改資料，權限只開啟SELECT, INSERT, UPDATE，新增完使用者重啟MySQL後結果還是一樣 &#8230;<br>上網找了找到 <a href="http://caterpillar.onlyfun.net/Gossip/JavaGossip-V2/ConnectDB.htm" target="_blank" rel="noopener noreferrer nofollow external" data-wpel-link="external" class="wpel-icon-right">Java Gossip: 連接資料庫 @ 良葛格學習筆記<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 裡面提到依資料庫的編碼可以加上 <strong><span style="color: #ff0000;">useUnicode</span></strong>, <span style="color: #ff0000;"><strong>characterEncoding </strong></span>這兩個參數(先筆記起來，之前的那篇沒寫到)，到這邊其他的 code 應該都沒問題才對，連線方式設定成<span style="color: #ff0000;"><strong>jdbc:mysql://remoteIP:3306/資料庫名稱</strong></span>。<br>熊熊想起來很久很久以前，也是卡在這個部份，看來應該是遠端網路設定的問題，果不其然在 <a href="http://blog.lyhdev.com/2006/07/mysql-server-error-2003-hy000.html" target="_blank" rel="noopener noreferrer nofollow external" data-wpel-link="external" class="wpel-icon-right">遠端無法連線到MySQL Server ERROR 2003 (HY000) @ 玩物尚誌<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 中看到兩個解決方式，以下內容截錄自 <a href="http://blog.lyhdev.com/2006/07/mysql-server-error-2003-hy000.html" target="_blank" rel="noopener noreferrer nofollow external" data-wpel-link="external" class="wpel-icon-right">遠端無法連線到MySQL Server ERROR 2003 (HY000) @ 玩物尚誌<span class="wpel-icon wpel-image wpel-icon-6"></span></a>：</p>
<blockquote>
<p>如果必須透過遠端檢視或操作 MySQL Server，需要修改一下設定檔，將 <span style="color: #ff0000;"><strong>bind-address</strong></span>、<span style="color: #ff0000;"><strong>skip-networking </strong></span>的選項取消(如果被開啟的話)。</p>
</blockquote>
<p>小蛙在自己的 ubuntu 上找了到 <span style="color: #ff0000;"><strong>/etc/mysql/my.cnf </strong></span>檔案果然就看到 <span style="color: #ff0000;"><strong>bind-address </strong></span>的設定，註解掉之後就可以正常連線囉！(開啟之後可能就必須要注意到一些安全性的問題了)<br>以下也先備份下來，玩物尚誌中提到用 <span style="color: #ff0000;"><strong>netstat -nl grep 3306 </strong></span>看看 mysql 是不是已經正常啟動，或者是如果有開啟防火牆的話，也有可能是被防火牆檔掉喔(<span style="color: #ff0000;"><strong>iptables -L</strong></span>)！先記錄下來，免得下次遇到又花了冤枉時間在找資料。</p>


<p><strong>MySQL / MariaDB / Oracle 相關文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list">
<li><a href="https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/" data-wpel-link="internal">MariaDB JSON_EXTRACT: 從 JSON 欄位取值</a></li>



<li><a href="https://noter.tw/12015/oracle-%e5%88%86%e7%b5%84%e7%b7%a8%e8%99%9f%e8%88%87%e5%85%a8%e6%8e%92%e5%ba%8f%e7%b7%a8%e8%99%9f-row_number-over-partition-by/" data-wpel-link="internal">Oracle, MySQL 分組編號與全排序編號 row_number, over, partition by</a></li>



<li><a href="https://noter.tw/3929/mysql-error-2003-hy000-%E7%84%A1%E6%B3%95%E9%81%A0%E7%AB%AF%E9%80%A3%E7%B7%9A/" data-wpel-link="internal">MySQL ERROR 2003 (HY000) 無法遠端連線</a></li>



<li><a href="https://noter.tw/2889/jsp-%E9%80%A3%E7%B5%90-mysql/" data-wpel-link="internal">JSP 連結 MySQL</a></li>



<li><a href="https://noter.tw/2883/java-%E9%80%A3%E7%B5%90-mysql/" data-wpel-link="internal">Java 連結 MySQL</a></li>



<li><a href="https://noter.tw/2306/mysql%E6%8E%92%E7%A8%8Bevent-scheduler/" data-wpel-link="internal">MySQL 排程(Event Scheduler)</a></li>



<li><a href="https://noter.tw/1988/java%E9%80%A3%E7%B5%90%E9%81%A0%E7%AB%AFmysql/" data-wpel-link="internal">Java 連結遠端 MySQL</a></li>



<li><a href="https://noter.tw/4508/mariadb-replication-%E8%A8%AD%E5%AE%9A/" data-wpel-link="internal">MariaDB Replication 設定</a></li>



<li><a href="https://noter.tw/122/java-php-%E6%8F%92%E5%85%A5-emoji-%E8%B3%87%E6%96%99%E5%88%B0-mariadb/" data-wpel-link="internal">Java / PHP 插入 emoji 資料到 MariaDB</a></li>
</ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/1988/java%e9%80%a3%e7%b5%90%e9%81%a0%e7%ab%afmysql/" data-wpel-link="internal">Java 連結遠端 MySQL</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/1988/java%e9%80%a3%e7%b5%90%e9%81%a0%e7%ab%afmysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
