[R] connecting [logging] RMySQL to an external server - SOLVED

Dirk Eddelbuettel edd at debian.org
Wed Dec 19 17:04:59 CET 2007

On Wed, Dec 19, 2007 at 04:34:26PM +0200, Adrian Dusa wrote:
> On Saturday 15 December 2007, Gabor Grothendieck wrote:
> > Use ssh forwarding to forward local port 3307 to remote port 3306
> > specifying the remote account and password.  Then if you use local port
> > 3306 you can access your local version of MySQL and if you
> > use port 3307 you can access the remote version.   There is some
> > info on the MySQL site.  First test it out by running the mysql command
> > line program accessing the remote data base via port 3307 and once
> > that works you know its ok and you can try RMySQL or RODBC packages.
> For those interested in using R with a remote MySQL database, here's the most 
> simple and straightforward solution (thanks to Gabor):
> On the console, forward local port 3307 to remote port 3306
> ssh -L 3307:xxx.xxx.xxx.xxx:3306 myuser at xxx.xxx.xxx.xxx
> (where xxx.xxx.xxx.xxx is the IP of the remote server and myuser is the login 
> name). After entering the password, keep that console open.
> In R:
> library(RMySQL)
> drv <- dbDriver("MySQL")
> dbConnect(drv, user="mysqluser", password="mysqlpassword", 
> dbname="anydatabase", host="", port="3307")

Err, I am late to this but

 dbConnect(drv, user="mysqluser", password="mysqlpassword", dbname="anydatabase", host="xxx.xxx.xxx")

works fine for me (eg on Ubuntu with a remote MySQL on some other
box).  What's the problem you were seeing?


Three out of two people have difficulties with fractions.

More information about the R-help mailing list