通过ssh来远程管理Mysql

Linux VPS 支持
回复
头像
oneleaf
论坛管理员
帖子: 10448
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

通过ssh来远程管理Mysql

#1

帖子 oneleaf » 2010-03-13 13:21

一般不要将mysql的端口对外开放,防止暴力破解。

1 连接,重定向本地的3306端口到远程:
linux下直接使用ssh:

代码: 全选

ssh -L 3306:127.0.0.1:3306 root@vpsip
windows下使用putty:
Go to the settings Connection > SSH > Tunneling
Add new forwarded port:
Source port: 3306
Destination: localhost:3306
Click on the "Local" radio button.
Click "Add"

2 本地直接连接:

代码: 全选

mysql -u root -h 127.0.0.1
hzg22998
帖子: 1
注册时间: 2010-03-12 21:49

Re: 通过ssh来远程管理Mysql

#2

帖子 hzg22998 » 2010-03-13 13:23

:em11
头像
pityonline
帖子: 3864
注册时间: 2008-12-09 12:44
来自: 北京
联系:

Re: 通过ssh来远程管理Mysql

#3

帖子 pityonline » 2010-03-14 16:49

直接用ssh连接到vps上操作mysql不就行了吗?我不明白端口重定向有什么意义……
Pity is the bomp!
活着就是折腾!生命不息,折腾不止!
看这帮家伙在干什么?@pityonline/u
Dropbox+Vps+PC 跑起来了!这是邀请链接
头像
冲浪板
论坛版主
帖子: 7513
注册时间: 2007-05-06 8:19

Re: 通过ssh来远程管理Mysql

#4

帖子 冲浪板 » 2010-03-14 17:18

too:127.0.0.1:too
是教科书上的写法,实际上这样做多数是失败
回复