Reputation: 8178
How to use MySQL in R (statistic language) for Windows (7)?
There is no problems then using linux:
install.packages('RMySQL')
library(RMySQL)
...
But I found no such package for Windows on CRAN. There is only note about this fact. I found package for version 2.10, but it is not usable in 2.12.1.
Also tried
install.packages("RMySQL", type="source")
but got an error :
* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/.../R/win-library/2.12/RMySQL'
Is there any way to connect to MySQL database from R in windows?
Upvotes: 14
Views: 10737
Reputation: 8178
Found solution with help of ran2, who gave me link to common question. The basic process is described here, but there are several hints, So I will describe the whole solution (please change the R version and paths if needed):
C:\Program Files\R\R-2.12.1\etc\Renviron.site
and add line like MYSQL_HOME=C:/mysql
(path to your mysql files)C:\Program Files\R\R-2.12.1\bin
or to windows/system32
directory.install.packages('RMySQL',type='source')
and wait while compilation will end.Thanks to all who tried to answer.
Upvotes: 14
Reputation: 28264
possible duplicate. However, my suggestions is to try WAMP which comes as a one click install. Admittedly you get more than you need (webserver) but the MySQL installation runs pretty well.
Upvotes: 1
Reputation: 10437
You need to install the MySQL headers and libraries, as explained in the installation instructions. Please do read the documentation before turning to SO.
Upvotes: 0