从Windows连接SSH MySQL服务器 [英] Connect SSH MySQL server from Windows

查看:406
本文介绍了从Windows连接SSH MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Ubuntu上使用SSH安装了MySQL,并希望连接安装在Windows上的 phpMyAdmin 机器.

I have installed MySQL on Ubuntu using SSH and would like to connect phpMyAdmin installed on a Windows machine.

我试图添加服务器(如标准服务器),但无法使用SSH登录到MySQL服务器. phpMyAdmin是否支持使用SSH连接远程服务器?如果是,如何为phpMyAdmin配置私钥,或者为此需要SSH客户端?

I tried to add a server like standard server, but I can not log in to MySQL server using SSH. Does phpMyAdmin support to connect a remote server using SSH? If yes, how can I configure a private key for phpMyAdmin or do I need a SSH client for this?

推荐答案

我认为存在一些误解,可能会妨碍您进行分类.

I think there's a bit of misunderstanding that might be hindering you sorting this out.

SSH是安全Shell协议,它允许用户远程访问服务器的命令行.您可以使用SSH在服务器上启动命令行会话,并使用mysql命令行客户端,就像直接在计算机上一样,通过SSH访问MySQL.

SSH is the Secure Shell protocol, which allows a user to remotely access the command line of a server. You can access MySQL via SSH by using SSH to start a command line session on the server and using the mysql command line client as if you were at the machine directly.

phpMyAdmin可以连接到本地MySQL实例(MySQL和Web服务器在同一台计算机上运行)或通过网络连接到另一台计算机(其中MySQL在一台计算机上运行,​​而Web服务器在另一台计算机上运行-连接在这种情况下,是通过MySQL本身使用的端口(3306).无论哪种情况,都可以从网络上的任何浏览器访问phpMyAdmin本身.它只是显示为任何网页.可以根据需要对MySQL和phpMyAdmin之间的通信进行加密(通过SSL),但是仍然可以通过MySQL通信而不是通过SSH进行通信.绝对不要将SSH用于从Web服务器到MySQL服务器的通信.

phpMyAdmin can connect to a local MySQL instance (where MySQL and your webserver run on the same machine) or connect to another machine through the network (where MySQL is running on one machine and your webserver is running on another -- the connection in this case is via the the port used by MySQL itself, 3306). In either case, you can access phpMyAdmin itself from any browser on the network; it just appears as any web page. The communication between MySQL and phpMyAdmin can be encrypted (via SSL) if you wish, but still happens via MySQL communication and not over SSH. At no point is SSH used for the communication from the web server to the MySQL server.

因此,在您的情况下,由于您希望在Windows机器上安装phpMyAdmin,因此只需使用$cfg['Servers'][$i]['host'] = 'hostname';指令编辑config.inc.php即可使用$cfg['Servers'][$i]['host'] = 'hostname';指令连接到Ubuntu服务器的IP地址或主机名.而是实际的主机名.然后,您可以使用Windows计算机的主机名或IP地址从网络上的任何位置访问phpMyAdmin.

So in your case, since you wish to install phpMyAdmin on the Windows box, you'd simply edit your config.inc.php to connect to the IP address or hostname of the Ubuntu server with the $cfg['Servers'][$i]['host'] = 'hostname'; directive, using the actual hostname instead. You'd then access phpMyAdmin from anywhere on the network by using the hostname or IP address of the Windows machine.

相反,如果您希望将phpMyAdmin安装到Ubuntu计算机上,则可以在config.inc.php中使用主机名"localhost",然后使用Ubuntu从Windows计算机(或任何其他计算机)访问phpMyAdmin. Web浏览器中的IP地址/主机名.

If, instead, you wish to install phpMyAdmin on to the Ubuntu machine, you could use the host name 'localhost' in config.inc.php and then access phpMyAdmin from the Windows machine (or any other machine) using the Ubuntu IP address/host name in your web browser.

这完全取决于您希望将哪台机器用作Web服务器. phpMyAdmin在IIS上运行,而Apache在Windows上运行,但是Ubuntu通过软件包管理器使安装所有程序变得容易,因此在这种情况下我通常会这样做.

It all depends which machine you wish to be the web server. phpMyAdmin runs under IIS or Apache runs under Windows, but Ubuntu makes installing all the programs easy through the package manager, so that's what I generally do in this situation.

希望可以帮助清除它.

这篇关于从Windows连接SSH MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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