I'm trying to install RMySQL on Windows 8.1. I already have MySQL Server 5.1
and R 3.0.3
installed. They're both added to the system path, and can be invoked from anywhere by typing mysql -u root -p
or R
in the command prompt.
I followed the instructions in this page http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL and installed Rtools
, and then created an Renviron.site
file in the /etc
folder of my R installation. In the Renviron.site
file I correctly set the MYSQL_HOM
E as follows :
MYSQL_HOME="C:\Program Files\MySQL\MySQL Server 5.6"
I then restarted RStudio and tried to install RMySQL
by typing
install.packages('RMySQL',type='source')
The package got downloaded correctly, but gave a host of warnings and errors while installing. I'm pasting them here.
Installing package into ‘C:/Users/.../Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/RMySQL_0.9-3.tar.gz'
Content type 'application/x-gzip' length 165363 bytes (161 Kb)
opened URL
downloaded 161 Kb
* installing *source* package 'RMySQL' ...
** package 'RMySQL' successfully unpacked and MD5 sums checked
checking for $MYSQL_HOME... C:\Program Files\MySQL\MySQL Server 5.6
cygwin warning:
MS-DOS style path detected: C:\Program
Preferred POSIX equivalent is: /cygdrive/c/Program
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
test: Files\MySQL\MySQL: unknown operand
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-30~1.3/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-30~1.3/etc/x64/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc -m64 -I"C:/PROGRA~1/R/R-30~1.3/include" -DNDEBUG -I"C:\Program Files\MySQL\MySQL Server 5.6"/include -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c RS-DBI.c -o RS-DBI.o
RS-DBI.c: In function 'RS_na_set':
RS-DBI.c:1219:11: warning: variable 'c' set but not used [-Wunused-but-set-variable]
gcc -m64 -I"C:/PROGRA~1/R/R-30~1.3/include" -DNDEBUG -I"C:\Program Files\MySQL\MySQL Server 5.6"/include -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c RS-MySQL.c -o RS-MySQL.o
RS-MySQL.c: In function 'RS_MySQL_fetch':
RS-MySQL.c:657:13: warning: variable 'fld_nullOk' set but not used [-Wunused-but-set-variable]
RS-MySQL.c: In function 'RS_DBI_invokeBeginGroup':
RS-MySQL.c:1137:30: warning: variable 'val' set but not used [-Wunused-but-set-variable]
RS-MySQL.c: In function 'RS_DBI_invokeNewRecord':
RS-MySQL.c:1158:20: warning: variable 'val' set but not used [-Wunused-but-set-variable]
RS-MySQL.c: In function 'RS_MySQL_dbApply':
RS-MySQL.c:1219:38: warning: variable 'fld_nullOk' set but not used [-Wunused-but-set-variable]
gcc -m64 -shared -s -static-libgcc -o RMySQL.dll tmp.def RS-DBI.o RS-MySQL.o C:\Program Files\MySQL\MySQL Server 5.6/bin/libmySQL.dll -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-30~1.3/bin/x64 -lR
gcc.exe: error: C:\Program Files\MySQL\MySQL Server 5.6/bin/libmySQL.dll: No such file or directory
ERROR: compilation failed for package 'RMySQL'
* removing 'C:/Users/.../Documents/R/win-library/3.0/RMySQL'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-30~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\...\Documents\R\win-library\3.0" C:\Users\..~1\AppData\Local\Temp\RtmpcdXPKB/downloaded_packages/RMySQL_0.9-3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\...\AppData\Local\Temp\RtmpcdXPKB\downloaded_packages’
In my R console I double checked that my MYSQL_HOME
is set correctly, by typing Sys.getenv('MYSQL_HOME')
which printed [1] "C:\\\\Program Files\\\\MySQL\\\\MySQL Server 5.6"
How should I resolve these errors?
It worked. All I had to do was copy the libmysql.dll
file from lib
folder of my MySQL installation directory to the bin
folder of the same.
After this, the install.packages('RMySQL',type='source')
command worked fine.
This link helped.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.