Dail
Dail

Reputation: 4606

How to use RMySQL in Windows?

I tried to use RMySQL package but i get this error doing:

install.packages('RMySQL')

Warning in install.packages :
  package ‘RMySQL’ is not available (for R version 2.14.2)

What can I do to use MySQL with R?

Thank you!

Upvotes: 9

Views: 4684

Answers (4)

LVLLFD
LVLLFD

Reputation: 101

I experienced some difficulty with installing RMySQL package in R, twice this year. I haven't used it, yet. To help me in getting around the known additional problems, I followed the steps I found in these two articles:

First you need to download, install and configure MySQL to work with Windows. Next, you will have to create or edit a file called Renviron.site, and add the variable MYSQL_HOME to your default environment, and other tricky tweaks that may have worked for other people, but have not worked for me.

It appears that running RMySQL on Windows is not advised; there are other packages that you can use to get R to work with MySQL. I've been checking out R bloggers, R Studio Support and the R Help Mailing List, for ways to get around the problem.

Although they're useful resources, there is no guarantee that the troubleshooting steps will work for everyone. You can try following them to install RMySQL package, and if they work you should be able to use the package with R.

Upvotes: 0

Catherine
Catherine

Reputation: 1

After spending 10Hours,I followed Arne's instructions and Willem's comment from here: http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/ and it worked like magic.

Upvotes: 0

Andrie
Andrie

Reputation: 179398

There is not a windows binary available for the package RMySQL. This means you will have to install this package from source and build it yourself.

At the CRAN RMySql page you will notice there is no binary available, with a link to Pre-compiled binary packages for R-2.14.x for Windows

From this page:

Packages related to many database system must be linked to the exact 
version of the database system the user has installed, hence it does 
not make sense to provide binaries for packages
    RMySQL, ROracle, ROracleUI,
although it is possible to install such packages from sources by
    install.packages('packagename', type='source')
after reading the manual 'R Installation and Administration'.

So, read the manuals, in particular R Installation and Administration, install RTools, and then use:

install.packages('RMySQL', type='source')

Upvotes: 4

G. Grothendieck
G. Grothendieck

Reputation: 269396

After installing Rtools, from the RMySQL CRAN page grab the source from the Package source: link to ensure that you have the latest version. Then read the information in the INSTALL file that comes with the package (or find the same info at the Installation: link on the aforementioned CRAN page).

The main problem that most people have is following outdated information on the internet that pertains to older versions of RMySQL rather than using the instructions that come with the package itself.

Upvotes: 2

Related Questions