[R] connecting [logging] RMySQL to an external server - SOLVED
daj025 at gmail.com
Wed Dec 19 18:38:25 CET 2007
I'm sorry I'm also coming late to this discussion, but like Dirk, I
fail to understand what's wrong with using dbConnect() the way
the documentation, (see ?MySQL) suggests.
RMySQL was developed in a fully distributed client/server
environment, and it uses the MySQL-provided client API. The
options that the MySQL client library allows (user, password, host,
port or socket file, compression, etc.) should work from RMySQL
(RMySQL just passes those directly to the MySQL client library).
If you have a specific (e.g., security-related) need that the MySQL client
API does not address, then the use of ssh may be the proper way
to go. But for simple, vanilla style of client-server communications
the underlying MySQL client should be sufficient.
On Dec 19, 2007 11:04 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> 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="127.0.0.1", 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.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help