Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在OSX上的Rstudio中使用SSH连接到MySQL_Mysql_R_Macos_Ssh - Fatal编程技术网

在OSX上的Rstudio中使用SSH连接到MySQL

在OSX上的Rstudio中使用SSH连接到MySQL,mysql,r,macos,ssh,Mysql,R,Macos,Ssh,我知道这里讨论过这个问题,但我不知所措。 我有一个R代码连接到MySQL,运行良好。最近,我们将连接更改为通过SSH,现在,我无法连接。 当我尝试使用SSH连接到同一个MySQL服务器时,我得到以下结果: Warning: Error in .local: Failed to connect to database: Error: Can't connect to MySQL server on 'server.url.' (57) Stack trace (inne

我知道这里讨论过这个问题,但我不知所措。 我有一个R代码连接到MySQL,运行良好。最近,我们将连接更改为通过SSH,现在,我无法连接。 当我尝试使用SSH连接到同一个MySQL服务器时,我得到以下结果:

    Warning: Error in .local: Failed to connect to database: Error: 
    Can't connect to MySQL server on 'server.url.' (57)

    Stack trace (innermost first):
        47: .local
        46: dbConnect
        45: dbConnect
    Error in .local(drv, ...) : 
    Failed to connect to database: Error: Can't connect to MySQL server on...
这是我的一段代码,运行良好并建立了连接:

system(paste("chmod 600 ", MySSHkey))
system(paste("ssh -v -f -N -o StrictHostKeyChecking=no -i ", MySSHkey, " -L 1234:127.0.0.1:1234 ", MySSHuser,"@",MySSHhost, sep = ""))
然后,在运行dbConnect部件时:

oConn <- dbConnect(
 drv = RMySQL::MySQL(),
 dbname = MySQLDBname,
 host = MySQLHost,
 username = MySQLName,
 password = MySQLPswrd
)

尝试连接到主机
127.0.0.1:1234
而不是
MySQLHost
ssh
在该地址和服务器之间创建转发链接。我不知道,这甚至可能是一个单独的问题。请将此新发现编辑到您的问题中。
Failed to connect to database: Error: Lost connection to MySQL server at 'handshake: reading inital communication packet', system error: 57