0

我使用了本指南:Using MySQL in R for Windows,但没有帮助。我已经在这个问题上搜索了几个小时。由于我无法弄清楚我的问题,所以我可以在尝试时将日志发送到这里install.packages('RMySQL',type='source')

> Warning in install.packages :   package ‘RMySQL’ is not available (for
> R version 3.0.2) Installing package into ‘C:/Users/Mr.
> Kox/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' ...
> ** Paket 'RMySQL' erfolgreich entpackt und MD5 Summen überprüft
>       0 [main] sh 6324 find_fast_cwd: WARNING: Couldn't compute FAST_CWD pointer.  Please report this problem to the public mailing
> list cygwin@cygwin.com checking for $MYSQL_HOME... C:/xampp/mysql
> cygwin warning:   MS-DOS style path detected: C:/xampp/mysql  
> Preferred POSIX equivalent is: /cygdrive/c/xampp/mysql   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
> ** libs Warnung: this package has a non-empty 'configure.win' file, so building only the main architecture
> 
>       0 [main] make 6988 find_fast_cwd: WARNING: Couldn't compute FAST_CWD pointer.  Please report this problem to the public mailing
> list cygwin@cygwin.com cygwin warning:   MS-DOS style path detected:
> C:/PROGRA~1/R/R-30~1.2/etc/x64/Makeconf   Preferred POSIX equivalent
> is: /cygdrive/c/PROGRA~1/R/R-30~1.2/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.2/include" -DNDEBUG -I"C:/xampp/mysql"/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.2/include" -DNDEBUG -I"C:/xampp/mysql"/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:/xampp/mysql/bin/libmySQL.dll
> -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-30~1.2/bin/x64 -lR collect2: ld returned 5 exit status ERROR: compilation failed for package 'RMySQL'
> * removing 'C:/Users/Mr. Kox/Documents/R/win-library/3.0/RMySQL'
> * restoring previous 'C:/Users/Mr. Kox/Documents/R/win-library/3.0/RMySQL' Warning in install.packages : 
> running command '"C:/PROGRA~1/R/R-30~1.2/bin/x64/R" CMD INSTALL -l
> "C:\Users\Mr. Kox\Documents\R\win-library\3.0"
> C:\Users\MRFFAF~1.KOX\AppData\Local\Temp\RtmpCGe2RS/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\Mr.
> Kox\AppData\Local\Temp\RtmpCGe2RS\downloaded_packages’

我认为主要问题在于“collect2:ld 返回 5 退出状态”。好吧,也许你们可以帮助我。总的来说,我只想将 R-Studio 与 MySQL 数据库连接起来。谢谢。

4

2 回答 2

0

找到了解决方案。这很容易。

转到 R-Studio -> 工具 -> 选项 -> R-Version -> 在这里而不是当前选择“[默认] [32-bit] C:\Program Files\R\R-3.0.2”

现在它适用于上述问题。玩得开心。

于 2013-11-18T10:01:10.940 回答
0

使用 RODBC 和本指南:http ://www.joyofdata.de/blog/make-r-talk-to-mysql-on-windows/

您显然正在使用 R 64bit - 然后使用 64bit 连接器很重要。

于 2013-11-18T11:38:07.380 回答