Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use RMySQL in Windows?

Tags:

mysql

windows

r

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!

like image 859
Dail Avatar asked Mar 17 '12 08:03

Dail


People also ask

How do I run MySQL on my PC?

The simplest and recommended method is to download MySQL Installer for Windows from https://dev.mysql.com/downloads/installer/ and execute it. Select mysql-installer-web-community-8.0. 23. msi if you have good internet connection, otherwise choose mysql-installer-community-8.0.

How do I run a database in MySQL?

Open the Command Prompt and navigate to the bin folder of your MySQL Server installation directory. Then connect to the server using the mysql -u root -p command. Enter the password and execute the SHOW DATABASES; command we have discussed above.


2 Answers

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')
like image 140
Andrie Avatar answered Sep 20 '22 13:09

Andrie


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.

like image 34
G. Grothendieck Avatar answered Sep 20 '22 13:09

G. Grothendieck