简体   繁体   English

无法安装RMySQL软件包

[英]Unable to install RMySQL package

I'm trying to install RMySQL on Windows 8.1. 我正在尝试在Windows 8.1上安装RMySQL。 I already have MySQL Server 5.1 and R 3.0.3 installed. 我已经安装了MySQL Server 5.1R 3.0.3 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. 它们都被添加到系统路径中,并且可以通过在命令提示符下键入mysql -u root -pR在任何地方调用。

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. 我按照本页http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL中的说明进行操作,并安装了Rtools ,然后在R安装的/etc文件夹中创建了一个Renviron.site文件。 In the Renviron.site file I correctly set the MYSQL_HOM E as follows : Renviron.site文件中,我正确设置了MYSQL_HOM E,如下所示:

MYSQL_HOME="C:\Program Files\MySQL\MySQL Server 5.6"

I then restarted RStudio and tried to install RMySQL by typing 然后,我重新启动RStudio,并尝试通过键入以下命令安装RMySQL

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" 在我的R控制台中,我通过键入Sys.getenv('MYSQL_HOME')仔细检查了我的MYSQL_HOME是否设置正确,该文件打印了[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. 我要做的就是将libmysql.dll文件从MySQL安装目录的lib文件夹复制到同一文件夹的bin文件夹中。

After this, the install.packages('RMySQL',type='source') command worked fine. 之后, install.packages('RMySQL',type='source')命令运行正常。

This link helped. 链接有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM