最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
使用SSH通道訪問MySQL的方法

許多時候當要使用MySQL時,會遇到如下情況:

創(chuàng)新互聯(lián)公司是專業(yè)的范縣網(wǎng)站建設公司,范縣接單;提供成都網(wǎng)站設計、網(wǎng)站制作、外貿(mào)營銷網(wǎng)站建設,網(wǎng)頁設計,網(wǎng)站設計,建網(wǎng)站,PHP網(wǎng)站建設等專業(yè)做網(wǎng)站服務;采用PHP框架,可快速的進行范縣網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!

1. 信息比較重要,希望通信被加密。

2. 一些端口,比如3306端口,被路由器禁用。

對第一個問題的一個比較直接的解決辦法就是更改mysql的代碼,或者是使用一些證書,不過這種辦法顯然不是很簡單。

相關學習視頻教程推薦:mysql視頻教程

這里要介紹另外一種方法,就是利用SSH通道來連接遠程的Mysql,方法相當簡單。

一、建立SSH通道

只需要在本地鍵入如下命令:

ssh -fNg -L 3307:127.0.0.1:3306 [email protected]
The command tells ssh to log in to remotehost.com as myuser, go into the background (-f) and not execute any remote command (-N), and set up port-forwarding (-L localport:localhost:remoteport ). In this case, we forward port 3307 on localhost to port 3306 on remotehost.com.

二、連接Mysql

現(xiàn)在,你就可以通過本地連接遠程的數(shù)據(jù)庫了,就像訪問本地的數(shù)據(jù)庫一樣。

mysql -h 127.0.0.1 -P 3307 -u dbuser -p db
The command tells the local MySQL client to connect to localhost port 3307 (which is forwarded via ssh to remotehost.com:3306). The exchange of data between client and server is now sent over the encrypted ssh connection.

或者用Mysql Query Brower來訪問Client的3307端口。

類似的,用PHP訪問:


Making It A Daemon
A quick and dirty way to make sure the connection runs on startup and respawns on failure is to add it to /etc/inittab and have the init process (the, uh, kernel) keep it going.
Add the following to /etc/inittab on each client:
sm:345:respawn:/usr/bin/ssh -Ng -L 3307:127.0.0.1:3306 [email protected]
And that should be all you need to do. Send init the HUP signal ( kill -HUP 1 ) to make it reload the configuration. To turn it off, comment out the line and HUP init again.

以上就是詳解如何通過SSH通道來訪問MySQL的詳細內(nèi)容,更多請關注創(chuàng)新互聯(lián)其它相關文章!


網(wǎng)頁題目:使用SSH通道訪問MySQL的方法
標題網(wǎng)址:http://fisionsoft.com.cn/article/iieghe.html