无法通过终端(ssh)访问fortrabbit mysql数据库 [英] can't access fortrabbit mysql db through terminal (ssh)

查看:195
本文介绍了无法通过终端(ssh)访问fortrabbit mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法通过fortrabbit上的终端访问mysql.我按照所有步骤操作,但是它拒绝了我的密码.但是,我可以通过ssh进行正式登录并编辑我的应用程序.有人遇到过这个问题吗?谢谢.

I can't access mysql through terminal on fortrabbit. I follow all steps but it is rejecting my password. However I can regullary login through ssh and edit my application. Anyone had that issue ? Thanks.

推荐答案

我过去使用 SSH隧道.打开到服务器的SSH隧道,然后从该隧道的端点连接到MySQL服务器.因此,对于MySQL,您似乎正在本地连接.

I have solved this in the past using a SSH tunnel. You open an SSH tunnel to the server, and then you connect to the MySQL server there from the endpoint of that tunnel. As such, to MySQL you appear to be connecting locally.

从终端:

首先,您需要打开隧道,您可以这样做:

First you need to open the tunnel, you can do it like this:

ssh -N -L8889:127.0.0.1:3306 username@your.fortrabbit.domain.com &

这将打开端口8889,然后打开到your.fortrabbit.domain.com的隧道,然后将该本地端口通过转发到IP 127.0.0.1和端口3306 relative 到服务器位于your.fortrabbit.domain.com.

This opens port 8889, then opens a tunnel to your.fortrabbit.domain.com, then forwards that local port through the tunnel to the IP 127.0.0.1 and port 3306 relative to the server at your.fortrabbit.domain.com.

更详细的选项:

-N :请勿执行远程命令.
-L :指定端口(本地和远程).
8889 :您正在转发的本地端口.
127.0.0.1 :您要转发到的远程IP,相对于ssh连接到的服务器
3306 :您要转发到的远程端口.
username@your.fortrabbit.domain.com :您的用户名和具有totrabbit的域名.

-N: Do not execute a remote command.
-L: Specifies the ports (local and remote).
8889: Your local port that is being forwarded.
127.0.0.1: the remote IP to which you're forwarding, relative to the server which ssh is connecting to
3306: the remote port to which you're forwarding.
username@your.fortrabbit.domain.com: Your username and domain with fortrabbit.

现在您可以打开连接了.在同一终端中,使用以下命令:

Now you're ready to open the connection. In the same terminal, use the following command:

mysql -h 127.0.0.1 -P 8889 -u mysql-username -p

端口8889现在正被转发到Fortrabbit端的MySQL服务器的端口和IP,因此只需将mysql-username替换为mysql服务器上的用户名,就可以连接了!

port 8889 is now being forwarded to the port and IP of your MySQL server on the fortrabbit side, so just replace mysql-username with your username on the mysql server, and you're connected!

通过GUI:

您在评论中提到您正在使用Ubuntu,因此请从软件中心或Standard TCP/IP over SSH".

You mentioned in your comments that you're using Ubuntu, so install MySQL Workbench from the Software Centre or here, create a New Connection and select the connection type as "Standard TCP/IP over SSH".

您将需要配置以下内容:

You will need to configure the following:

SSH Hostname :带有fortrabbit的ssh帐户的主机名或IP
SSH Username :您的用户名
SSH Password :您的密码
SSH Keyfile :如果您使用密钥进行身份验证,请在此处选择私有密钥.
MySQL Hostname :127.0.0.1(因为它在隧道的端点本地.
MySQL Server Port :通常为"3306".
Username :数据库的用户名
Password :数据库的密码
Default Schema :此数据库的默认架构应该是什么(可以保留为空白).

SSH Hostname: the hostname or IP of your ssh account with fortrabbit
SSH Username: your username with them
SSH Password: your password with them
SSH Keyfile: If you use keys for authentication, select the private one here.
MySQL Hostname: 127.0.0.1 (because it's local to the endpoint of your tunnel.
MySQL Server Port: normally "3306".
Username: The username for the DB
Password: The password for the DB
Default Schema: Whatever should be the default schema for this DB (can be left blank).

然后无论您身在何处都可以连接!

That should then connect from wherever you are!

这篇关于无法通过终端(ssh)访问fortrabbit mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆