douer9399
douer9399
2012-06-12 19:54
浏览 38
已采纳

Php:Mysql连接ssh主机名

In my sql host environment when I try to connect to mysql I have to go through a ssh host. Here is my connection:

ssh hostname: server01
username : user
pwd: password

mysqlhostname : mysql01
port : 3306
username : mysqluser
pwd: mysqlpwd

How can I connect to the database in php?

图片转代码服务由CSDN问答提供 功能建议

在我的sql主机环境中,当我尝试连接到mysql时,我必须通过ssh主机。 这是我的连接:

  ssh hostname:server01 
username:user 
pwd:password 
 
mysqlhostname:mysql01 
port:3306 
username:mysqluser 
pwd:mysqlpwd \  n   
 
 

如何在php中连接数据库?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongritan5654
    dongritan5654 2012-06-12 20:06
    已采纳

    You can't. What you need to do is setup an SSH tunnel from your webserver to your SSH host and then use localhost with the port of your tunnel in PHP.

    点赞 评论

相关推荐