RMySQL Windows 7 Home Installation Error
-
12-11-2019 - |
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.
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/):
Install R on a path that does not contain a space.
download R from: cran.r-project.org/bin/windows/base/
double click the downloaded .exe file
press Run when the security warning appears
press Yes when the User Account Control message box appears
Choose your language (I choose English)
when prompted for where to install R, choose a location without a space. I choose “C:\R\R-2.14.0″
click Next on all following screens to finish installation (I left the defaults unaltered).
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)
Go to this webpage: http://cran.r-project.org/bin/windows/Rtools/ (Rtools214.exe)
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
press Run when the security warning appears
press Yes when the User Account Control message box appears
choose your language (I choose English)
choose where to install (I chose “C:\R\Rtools”)
click Next on all following screens to finish installation (I left the defaults unaltered).
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)
go to: cran.r-project.org/contrib/extra/batchfiles/
choose the latest version (I chose batchfiles_0.6-6.zip)
when downloaded, right click on file and click Extract All.
click Browse and choose where you want to put the extracted folder (I chose “C:\R\”)
Download Redmond Path Utility to alter PATH variables in a very user friendly fashion:
go to: download.cnet.com/Redmond-Path/3000-2094_4-10811594.html
click on “Download Now CNET Secure Download”
double click the downloaded .exe file
press Run when the security warning appears
press Yes when the User Account Control message box appears
press Next
press Decline (unless you want the annoying advertising extra).
click open
An explorer window will open with RedmondPath.zip
click Extract All.
click Browse and choose where you want to put the extracted folder (I chose “C:\R\”)
Edit PATH variable to allow system wide access to the current version of R on the computer and components of Rtools
double click the Redmond Path Utility from step 4 above (mine is in: “C:\R\RedmondPath\Redmond Path.exe”)
click Yes when the User Account Control message box appears
click the green “+” icon in the top left corner so we can add elements to the PATH variable
In the window which pops open, navigate to “C:\R\batchfiles_0.6-6″ and click OK
click the green “+” icon in the top left corner so we can add elements to the PATH variable
In the window which pops open, navigate to “C:\R\Rtools\bin” and click OK
click the green “+” icon in the top left corner so we can add elements to the PATH variable
In the window which pops open, navigate to “C:\R\Rtools\MinGW\bin” and click OK
Restart your computer (this solved an issue where the edits to the PATH variable above had not taken immediate affect)