[R] Connection problem to MySQL

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 13 09:38:10 CEST 2003


On Tue, 13 May 2003, David Tudor wrote:

> What am I doing wrong?
> 
> 
>  >library(DBI)
>  > library(RMySQL)
>  > mgr <- dbDriver("MySQL")
>  > con <- dbConnect(mgr, host="http://localhost", dbname="marketing")
> Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (could not connect 
> (null)@http://localhost on dbname "marketing"
> )
>  > con <- dbConnect(mgr, host="http://localhost/", 
> dbname="c:/mysql/data/marketing/")
> Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (could not connect 
> (null)@http://localhost/ on dbname "c:/mysql/data/marketing/"
> )
> 
> 
> I am running:
> R1.7.0
> php 4.3.0
> MySQL 3.23.55
> Windows XP 5.1.2600
> Apache 1.3.27


A couple of problems which are immediately obvious:

1) host="http://localhost/" is not a host.  Try "localhost".

2) The pre-compiled RMySQL for R 1.7.0 is for MySQL 4.0.x.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list