本节介绍如何通过 SSH 获取到远程 MySQL 服务器的加密连接。信息由 David Carlson 提供 <dcarlson@mplcomm.com>。This section describes how to get an encrypted connection to a
remote MySQL server with SSH. The information was provided by
David Carlson <dcarlson@mplcomm.com>.
在你的 Windows 机器上安装 SSH 客户端。有关 SSH 客户端的比较,请参见 http://en.wikipedia.org/wiki/Comparison_of_SSH_clients。Install an SSH client on your Windows machine. For a comparison of SSH clients, see http://en.wikipedia.org/wiki/Comparison_of_SSH_clients.
启动您的 Windows SSH 客户端。设置
Host_Name = yourmysqlserver_URL_or_IP。设置userid=来登录您的服务器。此your_useriduserid值可能与您的 MySQL 账户用户名不同。Start your Windows SSH client. SetHost_Name =. Setyourmysqlserver_URL_or_IPuserid=to log in to your server. Thisyour_useriduseridvalue might not be the same as the user name of your MySQL account.设置端口转发。可以执行远程转发(设置
local_port: 3306,remote_host: yourmysqlservername_or_ip,remote_port: 3306)或本地转发(设置port: 3306,host: localhost,remote port: 3306)。Set up port forwarding. Either do a remote forward (Setlocal_port: 3306,remote_host:,yourmysqlservername_or_ipremote_port: 3306) or a local forward (Setport: 3306,host: localhost,remote port: 3306).保存所有内容,否则下次必须重新做。Save everything, otherwise you must redo it the next time.
使用您刚创建的 SSH 会话登录到您的服务器。Log in to your server with the SSH session you just created.
在您的 Windows 机器上,启动一些 ODBC 应用程序(例如 Access)。On your Windows machine, start some ODBC application (such as Access).
在 Windows 中创建一个新文件,并使用 ODBC 驱动程序连接到 MySQL,就像你平常做的那样,只是要在 MySQL 主机服务器中输入
localhost,而不是yourmysqlservername。Create a new file in Windows and link to MySQL using the ODBC driver the same way you normally do, except type inlocalhostfor the MySQL host server, notyourmysqlservername.
此时,您应该已经有一个通过 SSH 加密的到 MySQL 的 ODBC 连接。At this point, you should have an ODBC connection to MySQL, encrypted using SSH.