RMySQL is a database interface and MySQL driver for R. This version complies with the database interface definition as implemented in the package DBI 0.2-2.

The latest version will always be available here:


But until it has updated, you can get the source for RMySQL 0.8-0 here:

Installing the RMySQL source package

1. Download Rtools from here: https://cloud.r-project.org/bin/windows/Rtools/, making sure to install the correct version for your R version.

Besure that you place the Rtools bin path in your default path so that R can invoke the compilers.

2. Install a MySQL client library from http://www.mysql.com or http://dev.mysql.com. If you already installed a MySQL server, you may want to re-run the install to ensure that you also installed client header and library files. Note that Xampp doesn't include these.

3. Edit or create the file Renviron.site and add the variable MYSQL_HOME which contains the location of your MySQL install. The file typically isn't created when installing R, so you may need to create it yourself. You will want to place it under the /etc directory in your R Home area. If you don't know where that is, you can issue R.home() at your R prompt. You will be adding a variable named MYSQL_HOME in variable=value syntax. Here's an example:

Location of Renviron.site: C:/PROGRA~1/R/R-2.11~1.0/etc/Renviron.site

Content is:


4. Restart R andd execute install.packages('RMySQL',type='source') at the R prompt.

As long as you followed the above steps correctly, RMySQL will install cleanly and you will be able to immediately load it and use it. If for some reason it fails, a first place to look would be ensuring that the MYSQL_HOME environment variable is set. Issue Sys.getenv('MYSQL_HOME') from the R prompt. If it's empty, then you may want to re-check your Renviron.site file and make sure you have named it correctly, placed it in the correct directory, named MYSQL_HOME correctly, and added the correct value to it. Also notice that value is in a notation called 8 dot 3 notation. You can find that value for your directory path by issuing dir /x at the Windows command prompt.

Binaries No Longer Supported

I've found it too difficult to keep binary versions of RMySQL up to date with the latest R version and MySQL version. As Duncan Murdoch's Rtools is so easy to install and use, I recommend always compiling RMySQL from the latest source packages.
Topic revision: r16 - 19 Jul 2016, JeffreyHorner

This site is powered by FoswikiCopyright © 2013-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback