1

I'm quite new to R, but I've some experience in programming. I'm trying to install RMySQL on Windows 7 with MySQL Workbench 5.2 and I keep on getting the same errors. I've already checked different procedures, but keep on getting stuck:

http://vhaguiar.wordpress.com/2011/06/06/r-how-to-install-rmysql-in-windows-7-with-mysql-5-5/

http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

MySQL is up and running, I have moved libmysql.lib and libmysql.dll, but I keep on getting the following errors. I guess I cannot see the problem for what it really is. Do you have any suggestion?

install.packages("RMySQL", type="source")
--- Please select a CRAN mirror for use in this session ---
provo con l'URL 'http://cran.rakanu.com/src/contrib/RMySQL_0.8-0.tar.gz'
Content type 'application/x-gzip' length 160735 bytes (156 Kb)
URL aperto
downloaded 156 Kb

 ** installing *source* package 'RMySQL' ...
 ERROR: configuration failed for package 'RMySQL'
 * removing 'C:/Program Files/R/R-2.13.2/library/RMySQL'
 The downloaded packages are in
 ‘C:\Users\Matteo\AppData\Local\Temp\RtmpYHjzuR\downloaded_packages’
 Warning messages:
 1: running command 'C:/PROGRA~1/R/R-213~1.2/bin/i386/R CMD INSTALL -l "C:/Program               Files/R/R-2.13.2/library"        C:\Users\Matteo\AppData\Local\Temp\RtmpYHjzuR/downloaded_packages/RMySQL_0.8-0.tar.gz' had status 1 
 2: In install.packages("RMySQL", type = "source") :
   installation of package 'RMySQL' had non-zero exit status
  Sys.getenv('MYSQL_INC')
 [1] ""
   Sys.getenv('MYSQL_LIB')
 [1] ""
 Sys.getenv('MYSQL_DIR')
 [1] ""
 Sys.getenv('MYSQL_HOME')
 [1] "C:/PROGRA~1/MySQL/MYSQLS~1.5/"
 Sys.getenv('MYSQL_INC')
 [1] ""
  Sys.getenv('MYSQL_LIB')
 [1] ""
  Sys.getenv('MYSQL_DIR')
 [1] ""
  Sys.getenv('MYSQL_HOME')
 [1] "C:/PROGRA~1/MySQL/MYSQLS~1.5/"*

This is all using R version 2.13.2.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
user1000660
  • 11
  • 1
  • 2
  • Did you install RTools? Otherwise installing a source package won't work. I myself am using RODBC for accessing a MySQL database, works perfectly, without having to mess around with building source packages. – ROLO Oct 18 '11 at 08:54
  • @ROLO RMySQL isn't bad either, it's just that there's no binary available for windows. I use it on my Mac and I think compiling might be worth the effort. – Matt Bannert Oct 18 '11 at 09:36
  • Same question [here](http://stackoverflow.com/questions/4785933/adding-rmysql-package-to-r-fails), might give more info. – ROLO Oct 18 '11 at 09:46
  • I had similar trouble getting RMySQL set up (before eventually succeeding). One thing I did differently than the linked pages is to put `libmysql.dll` into `$MYSQL_HOME/bin`. You might also check that the path 'abbreviation' in your `MYSQL_HOME` environment variable is correct by using `dir /x c:/full/path/to/mysql_install`. Hope one of those helps. – Josh O'Brien Oct 18 '11 at 13:34
  • I just re-installed every both R and Rtools to direct problems with that. – user1000660 Oct 18 '11 at 14:05
  • Thanks to everyone. @ROLO: RTools are installed. I indeed installed the RODBC package correctly, but still I cannot get to set the PATH for the ODBC driver installed with MYSQL Connector. Should I copy them inside the R folder? – user1000660 Oct 19 '11 at 09:44
  • You do not need a path to drivers for ODBC. [Set up a DSN](http://www.geeksengine.com/article/mysql-odbc.html), and access the DB like this: require(RODBC) odbc <- odbcConnect("yourDSN") somedata <- sqlQuery(odbc, "SELECT * FROM some_table") – ROLO Oct 19 '11 at 12:05
  • And in case you use 64-bit Windows with 32-bit R you need to set up a [32-bit DSN](http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1010401). – ROLO Oct 19 '11 at 12:09
  • @ROLO: thanks a lot for the help! I've finally managed to connect Rx64 with my MySQL DB after have created a DNS. I hope this post can be useful for other people too. – user1000660 Oct 20 '11 at 10:29

1 Answers1

0

I recently installed RMySQL on WinXP 32-bit and had some issues as well. I have documented the issues I had and solutions I found at the following link

I also followed up with the package maintainer a few days ago. I haven't received a response yet. Hopefully we can better document the process. It seems your problem may be solved by issuing the r statement:

Sys.setenv(“MYSQL_HOME”=”C:/PROGRA~1/MySQL/MYSQLS~1.5″)

before installing RMySQL.

  • thanks for the quick reply! I have followed the process you describe in your post, but I still get the same error message. The PATH is now correctly set. Sys.getenv("MYSQL_HOME") [1] "C:/PROGRA~1/MySQL/MYSQLS~1.5/" I am running on win7 64bit, and I've copied the files in both i386 and x64, but without luck. Have you done anything else between the installation of R/RTools and the RMySQL package beside what you described in the post? – user1000660 Oct 19 '11 at 09:57
  • I don't have any other suggestions other than emailing the package maintainer. :-( – user316697 Oct 21 '11 at 03:15