Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save calchad/06c3a1aa63765848861a to your computer and use it in GitHub Desktop.
Save calchad/06c3a1aa63765848861a to your computer and use it in GitHub Desktop.

Installing RMySQL on Windows 7 x64 (or similar)

###Step 1. Install RTools. Head to official CRAN page http://cran.r-project.org/ and install the latest available RTools for your R version. Install both x86 and x64 versions to save your nerves.

###Step 2. Installing MySQL connectors Install MySQL C Connectors from official MySQL resource: http://dev.mysql.com/downloads/connector/c/ .

Make sure, that you're installing correct version which corresponds to your platform (x64).

Also check, that you've included installation of all components of C Connector in installation wizard (maybe exluding Documentation).

###Step 3. Create Renviron.site configuration file Head to your R installation, find directory etc and create file Renviron.site.

Add one line:

MYSQL_HOME=C:/MySQL/ConnectorC

(specify your own installation path from step 2, note that there are no ending backslash)

Save it. ####Step 3b (optional). Add MySQL location in registry Open your regedit (click Win+R, type "regedit" and click Enter).

Create node HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.

Then create just one key in this node: string parameter Location with value from your $MYSQL_HOME variable.

###Step 4. Move MySQL dll to bin folder Open your MySQL C Connector installation directory (which placed in $MYSQL_HOME variable before) and copy libmysql.dll from /lib directory to /bin directory.

###Step 5. Run your RStudio and install package. Now you can simply install RMySQL package from sources using command:

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

Check that everything is OK with command:

library(RMySQL)

###Step 6. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment