Question

I have tried pretty much everything suggested on stack overflow and on http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL but the installation still fails with the error message: "ERROR: configuration failed for package 'RMySQL'". I installed the MySQL server using the Windows installer and selected the full option so everything possible is installed. I then did the steps described about setting the environment variables and checked that

> Sys.getenv('MYSQL_HOME')
  [1] "C:/PROGRA~1/MySQL/MYSQLS~1.5/"

I have made copies of the .lib and .dll files as suggested here: adding RMySQL package to R fails (on Windows)?

I am out of ideas at this point and any help would be GREATLY appreciated.

Was it helpful?

Solution

Instead of using RMySQL you could use RODBC. After installing MySQL you should be able to add an ODBC data source with the MySQL ODBC driver (click on start and search for ODBC).

To install RMySQL (or any other package in R) from source on windows, follow the instructions from R-bloggers (http://www.r-bloggers.com/installing-rcpp-on-windows-7-for-r-and-c-integration/):

  1. Install R on a path that does not contain a space.

    1. download R from: cran.r-project.org/bin/windows/base/

    2. double click the downloaded .exe file

    3. press Run when the security warning appears

    4. press Yes when the User Account Control message box appears

    5. Choose your language (I choose English)

    6. when prompted for where to install R, choose a location without a space. I choose “C:\R\R-2.14.0″

    7. click Next on all following screens to finish installation (I left the defaults unaltered).

  2. Install Rtools for components necessary to build R (I think this has a C++ compiler included because I’m pretty sure my system didn’t already have another previous C++ compiler installed)

    1. Go to this webpage: http://cran.r-project.org/bin/windows/Rtools/ (Rtools214.exe)

    2. In the downloads section, choose a compatible version for your version of R. I’m using R-2.14.0 and thus chose Rtools214.exe

    3. press Run when the security warning appears

    4. press Yes when the User Account Control message box appears

    5. choose your language (I choose English)

    6. choose where to install (I chose “C:\R\Rtools”)

    7. click Next on all following screens to finish installation (I left the defaults unaltered).

  3. Download batchfiles to always point to the latest version of R on your system when running R from the command line (I have found that this saves a lot of time in the long run)

    1. go to: cran.r-project.org/contrib/extra/batchfiles/

    2. choose the latest version (I chose batchfiles_0.6-6.zip)

    3. when downloaded, right click on file and click Extract All.

    4. click Browse and choose where you want to put the extracted folder (I chose “C:\R\”)

  4. Download Redmond Path Utility to alter PATH variables in a very user friendly fashion:

    1. go to: download.cnet.com/Redmond-Path/3000-2094_4-10811594.html

    2. click on “Download Now CNET Secure Download”

    3. double click the downloaded .exe file

    4. press Run when the security warning appears

    5. press Yes when the User Account Control message box appears

    6. press Next

    7. press Decline (unless you want the annoying advertising extra).

    8. click open

    9. An explorer window will open with RedmondPath.zip

    10. click Extract All.

    11. click Browse and choose where you want to put the extracted folder (I chose “C:\R\”)

  5. Edit PATH variable to allow system wide access to the current version of R on the computer and components of Rtools

    1. double click the Redmond Path Utility from step 4 above (mine is in: “C:\R\RedmondPath\Redmond Path.exe”)

    2. click Yes when the User Account Control message box appears

    3. click the green “+” icon in the top left corner so we can add elements to the PATH variable

    4. In the window which pops open, navigate to “C:\R\batchfiles_0.6-6″ and click OK

    5. click the green “+” icon in the top left corner so we can add elements to the PATH variable

    6. In the window which pops open, navigate to “C:\R\Rtools\bin” and click OK

    7. click the green “+” icon in the top left corner so we can add elements to the PATH variable

    8. In the window which pops open, navigate to “C:\R\Rtools\MinGW\bin” and click OK

  6. Restart your computer (this solved an issue where the edits to the PATH variable above had not taken immediate affect)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top