[R-SIG-Mac] [R-sig-DB] R, RMySQL and OSX

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 8 07:42:25 CEST 2006


Please (as we ask) consult the R posting guide at

http://www.r-project.org/posting-guide.html

and

0) Do not send HTML mail.
1) Do not post to multiple lists.
2) Contact the maintainer first as it asks you to there. (It also tells 
you how to find out the maintainer and other relevant information.)


On Wed, 7 Jun 2006, Louis Springer wrote:

> I've got at least a partial resolution and workaround to my issue.
>
> The default unix.socket parameter on the dbConnect call is "/opt/
> local/var/run/mysql5/mysqld.sock" if unix.sock is not specified. I'm
> not sure where this unix.socket is coming from, but it doesn't work
> for me.
>
> The correct unix.sock parameter for my case is  "/tmp/mysql.sock".
>
> This works:
>
> con <- dbConnect(dbDriver("MySQL"), username="myuser",
> host="localhost", dbname="mydb", password="secret", unix.sock="/tmp/
> mysql.sock")
>
> This does not:
>
> con <- dbConnect(dbDriver("MySQL"), username="myuser",
> host="localhost", dbname="mydb", password="secret")
>
> I also have a patch to RS-MySQL.c to display the error message
> returned by MySQL on a connect error. What should I do with this? Who
> is the current maintainer for this code?
>
> The bit around the "my_sql_real_connect" should read something like:
>
>   if(!mysql_real_connect(my_connection, host, user, passwd, dbname,
> 		       port, unix_socket, client_flags)){
>     char buf[2048];
>     sprintf(buf, "could not connect %s@%s on dbname \"%s\"\nError:%s
> \n",
> 	    user, host, dbname, mysql_error(my_connection));
>     RS_DBI_errorMessage(buf, RS_DBI_ERROR);
>   }
>
> The current version clobbers "my_connection" on a failed connection
> rendering any call to "mysql_error(my_connection)" useless. My hacked
> RS-MySQL.c returns:
>
> Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (could not
> connect myuser at localhost on dbname "mydb"
> Error:Can't connect to local MySQL server through socket '/opt/local/
> var/run/mysql5/mysqld.sock' (2)
>
> for the error I was having, returning an informative mysql error
> message on the failed connection.
>
>
> Lou
>
> On Jun 7, 2006, at 9:58 PM, Louis Springer wrote:
>
>> In reference to a meesage from "jhorn at bu.edu", installation and
>> build problems on OSX Tiger for R and RMySQL, "RMySQL Error Messages,
>> crashing R" (https://stat.ethz.ch/pipermail/r-sig-mac/2006-February/
>> 002686.html), was Jason ever able to resolve the issues? I'm not
>> getting any of the compile issues referred to, but am unable to
>> connect, getting:
>>
>> RS-DBI driver: (could not connect xxx at localhost on dbname "dbname"
>>
>> My R version is R for Mac OS X Aqua GUI, 1.16 (3198), R 2.3.1
>> Framework
>> RMySQL version RMySQL_0.5-7
>> MySQL version mysql  Ver 14.12 Distrib 5.0.13-rc, for apple-
>> darwin8.2.0 (powerpc) using readline 5.0
>>
>> Thanks,
>> Lou

-- 
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-SIG-Mac mailing list