Skip to content

Instantly share code, notes, and snippets.

@danielvartan
Forked from ijlyttle/install_RMySQL.md
Created February 5, 2022 10:04
Show Gist options
  • Save danielvartan/62344e39b634846e068bcbe51e5ba46c to your computer and use it in GitHub Desktop.
Save danielvartan/62344e39b634846e068bcbe51e5ba46c to your computer and use it in GitHub Desktop.
how to install RMySQL

Keep in mind this page (http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL)

Windows 7

Install MySQL Community Server from (http://dev.mysql.com/downloads/mysql/)

Then (from StackOverflow)

  • Go to System->Advanced->Enviroment Variables, press New and Enter Variable name as MYSQL_HOME and Variable values as C:/PROGRA~1/MYSQL/MYSQLS~1.6, and notice that it is / not \. This is a bit different from the StackOverflow answer - the trick is to use the Windows shortname. Open a command window, go to your MySQL directory, and type dir /x to get the correct particular ending. From R, confirm by typing Sys.getenv("MYSQL_HOME").

  • Copy C:/Program Files/MySQL/MySQL Server 5.6/lib/libmysql.dll to C:/Program Files/MySQL/MySQL Server 5.6/bin

  • Create C:/Program Files/MySQL/MySQL Server 5.6/lib/opt folder and copy C:/Program Files/MySQL/MySQL Server 5.6/lib/libmysql.lib to the opt folder

In R, run install.packages('RMySQL',type='source')

Mac OS X Mavericks

Get RMySQL_0.9-3.tar.gz from CRAN

Get mysql-5.7.4-m14-osx10.7-x86_64.dmg from http://dev.mysql.com/downloads/mysql/5.7.html

Load and install the mysql package

link the library to the R framework library this is the trick, from the Mac terminal:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Frameworks/R.framework/Resources/lib

from the directory containing your CRAN download, from the Mac terminal:

R CMD INSTALL --configure-args='--with-mysql-inc=/usr/local/mysql/include --with-mysql-lib=/usr/local/mysql/lib' RMySQL_0.9-3.tar.gz

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