[R] RMySQL db connect
cinzia sala
sala.cinziafelicita at hsr.it
Fri Oct 5 16:03:58 CEST 2007
I would like a small help on establishing a connection on a remote
MySQL database using R
I am able to connect to a localhost database in mysql and perform
queries, but when I try to connect to a database on a remote host (to
which I usually have access through ssh) I fail to establish a
connection.
> library(RMySQL)
> drv <- dbDriver("MySQL")
> con_clinic <- dbConnect(drv, "pippo", "7777", "127.0.0.1", "3308",
dbname="DB")
Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (could not
connect pippo at 127.0.0.1 on dbname "DB"
Error:Access denied for user 'pippo'@'localhost' (using password: YES)
When I connect to the database outside R, I usually first establish a
ssh tunnel
ssh -L 3308:localhost:3306 pippo at 172.24.220.215
then, I connect to mysql db using MySQL query browser, that's why I
have configured the same kind of connection in R as well. My tunnel
ssh connection was active when I tried to connect through R
Many thanks
Cinzia
More information about the R-help
mailing list