将 RMySQL 包添加到 R 失败(在 Windows 上)?

发布于 2024-10-14 04:47:53 字数 1157 浏览 11 评论 0原文

我不明白为什么我的 RMySQL 包无法安装 - 这就是我得到的结果:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

我不认为这是 MySQL 安装的问题,因为正确的值似乎在注册表中:

> Sys.getenv('MYSQL_HOME')
                 MYSQL_HOME "C:/PROGRA~1/MySQL/MYSQLS~1.1/" 
> readRegistry("SOFTWARE\\MySQL AB", hive="HLM", maxdepth=2)
$`MySQL Server 5.1`
$`MySQL Server 5.1`$DataLocation
[1] "C:\\Documents and Settings\\All Users\\Application Data\\MySQL\\MySQL Server 5.1\\"

$`MySQL Server 5.1`$FoundExistingDataDir 
[1] "0"

$`MySQL Server 5.1`$Location 
[1] "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"

$`MySQL Server 5.1`$Version
[1] "5.1.54"

困惑。任何帮助将不胜感激!

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

> Sys.getenv('MYSQL_HOME')
                 MYSQL_HOME "C:/PROGRA~1/MySQL/MYSQLS~1.1/" 
> readRegistry("SOFTWARE\\MySQL AB", hive="HLM", maxdepth=2)

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

MySQL Server 5.1`

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

MySQL Server 5.1`$DataLocation [1] "C:\\Documents and Settings\\All Users\\Application Data\\MySQL\\MySQL Server 5.1\\"

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

MySQL Server 5.1`$FoundExistingDataDir [1] "0"

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

MySQL Server 5.1`$Location [1] "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

MySQL Server 5.1`$Version [1] "5.1.54"

Puzzled. Any help would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

眼泪也成诗 2024-10-21 04:47:53

基本过程在这里进行了描述,但是有几个提示,所以我会描述整个解决方案(请根据需要更改 R 版本和路径):

  1. 此处
  2. 安装MySQL或mysql的头文件和库文件
  3. 创建或编辑文件C:\Program Files\R\R-2.12.1\etc\Renviron.site 并添加类似 MYSQL_HOME=C:/mysql (mysql 文件的路径) 的行,
  4. 将 libmysql.lib 从 mysql/lib 复制到 mysql/lib/opt 以满足依赖关系。
  5. 将 libmysql.dll 复制到 C:\Program Files\R\R-2.12.1\binwindows/system32 目录。
  6. 运行 install.packages('RMySQL',type='source') 并等待编译结束。

这对我在 Windows 7 64 位上有效,因此 32 位版本应该没有问题

最初发布 这里(类似问题)。

The basic process is described here, but there are several hints, So I will describe the whole solution (please change the R version and paths if needed):

  1. Install latest RTools from here
  2. install MySQL or header and library files of mysql
  3. create or edit file C:\Program Files\R\R-2.12.1\etc\Renviron.site and add line like MYSQL_HOME=C:/mysql (path to your mysql files)
  4. copy libmysql.lib from mysql/lib to mysql/lib/opt to meet dependencies.
  5. copy libmysql.dll to C:\Program Files\R\R-2.12.1\bin or to windows/system32 directory.
  6. run install.packages('RMySQL',type='source') and wait while compilation will end.

This worked for me on Windows 7 64 bit, so there should be no problems with 32 bit versions

Initialy posted here (similar question).

小清晰的声音 2024-10-21 04:47:53

首先,我会尝试按照此页面上的说明进行操作:http://biostat.mc.vanderbilt。 edu/wiki/Main/RMySQL

然后,确保您的计算机上确实有 MySQL 客户端,而不仅仅是服务器本身。我自己也遇到过一个问题,我必须为客户端使用旧的二进制文件,但是您可以从 mysql 网站下载这些文件。

First I would try following the directions on this page: http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

Then, ensure that you actually have a MySQL client on your computer, not just the server itself. I've had a problem myself where I had to use an older binary for the client, but you can download these from mysql website.

脱离于你 2024-10-21 04:47:53

我创建了一个可能对人们有用的二进制文件:

http:// /kenahoo.blogspot.com/2011/09/rmysql-binary-for-windows-7.html

我基本上遵循了所有这些指示,包括范德比尔特页面上的指示,但由于某种原因它没有”似乎总是有效。无论如何,希望这对拥有与我使用的相同版本的东西的人有所帮助。

I created a binary which might work for people:

http://kenahoo.blogspot.com/2011/09/rmysql-binary-for-windows-7.html

I basically followed all these directions, including the ones at the Vanderbilt page, but for one reason or another it doesn't always seem to work. Anyway, hope this might be helpful for people who have the same versions of stuff I used.

跨年 2024-10-21 04:47:53

我在使用 R 2.12.1 x64 的 Windows 7 上遇到了同样的问题,并通过以下方法解决了该问题:

  1. 将我的 PATH 变量中的 R 目录更改为 C:\Program Files\R\R-2.12 .1\bin\x64(而不仅仅是...\R-2.12.1\bin)。
  2. 正在将 ...\MySQL Server 5.5\lib\libmysql.dll 复制到 ...\MySQL Server 5.5\bin\
  3. 在cmd.exe中运行R CMD INSTALL RMySQL_0.7-5.tar.gz(在R中install.packages('RMySQL',type='source')仍然会不工作)。

I was having this same problem on Windows 7 with R 2.12.1 x64 and resolved it by:

  1. Changing the R directory in my PATH variable to C:\Program Files\R\R-2.12.1\bin\x64 (rather than just ...\R-2.12.1\bin).
  2. Copying ...\MySQL Server 5.5\lib\libmysql.dll to ...\MySQL Server 5.5\bin\.
  3. Running R CMD INSTALL RMySQL_0.7-5.tar.gz in cmd.exe (install.packages('RMySQL',type='source') in R still would not work).
寂寞美少年 2024-10-21 04:47:53

我遇到了这个在 Windows7 64 位下安装 RMySQL 的分步指南。

http://www.ahschulz.de/2013/07/ 23/installing-rmysql-under-windows/

我使用的软件是:

  1. Windows 8 OS
  2. R3.0.2 - 64bit
  3. Rtools 3.1
  4. MySQL Server Community Edition 5.6 - 64bit

按照上面的指南(提供截图),我的安装和RMySQL 包的加载工作正常。

非常感谢阿恩·亨德里克·舒尔茨!

I came across this step-by-step guide to install RMySQL under Windows7 64bit.

http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/

The software I used are:

  1. Windows 8 OS
  2. R3.0.2 - 64bit
  3. Rtools 3.1
  4. MySQL Server Community Edition 5.6 - 64bit

Following the above guide (with screenshots provided), my installation and loading of the RMySQL package works.

Many thanks to Arne Hendrik Schulz!

枕头说它不想醒 2024-10-21 04:47:53

正如马雷克所说。该软件包没有 Windows 二进制文件。当我尝试安装 RPostgreSQL 时,我在 Mac 上也遇到了类似的问题(因为没有适用于 Mac 的二进制文件),最后我不得不自己编译它并修改几个文件。

对于 MySQL 部分(如果您对 MySQL 不太了解),您可能需要使用 WAMP诚然,这超出了您的需要,但易于安装、启动和关闭。

对于一些编译帮助,您可能会对 Rtools 感兴趣

HTH

顺便说一句:您运行什么类型的窗口(抱歉,如果我错过了)

As Marek said. There is no windows binary for this package. I had similar troubles on my Mac when I tried to install RPostgreSQL (because there's no binary for Mac) in the end I had to compile it on my own and modify several files.

For the MySQL part(if you don't know much about MySQL), you might want to use WAMP which is admittedly more than you need, but easy to install and to start and shut down.

For some compiling help you might be interested in Rtools

HTH

BTW: What kind of windows do you run (sry, if I missed it)

岁月染过的梦 2024-10-21 04:47:53

不过,目前还有一项附加要求(MySQL 服务器版本 5.5 和 R2.12.1)请遵循 http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL 说明作为 libmySQL 的位置。 dll 与包中预期的不同。

即64位编译。
它期望 libmySQL.dll 位于“${MYSQL_HOME}”/bin/libmySQL.dll 中
因此,只需将 dll 复制到 /bin 目录即可编译。

用于32位编译。
libmySQL.lib 预计位于“${MYSQL_HOME}”/lib/opt/libmysql.lib 中
再次移动这应该可以解决问题。

或者,如果您不想或无法移动这些文件。然后您可以编辑源代码文件:
Makevars.win
Makevars.win32
Makevars.win64
适当地指向 /lib/libmysql.dll /lib/libmysql.lib

You however there is one additional requirement at present (with the MySQL server version 5.5 & R2.12.1) follow thehttp://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL instructions at present as the locations of the libmySQL.dll differs to what is expected in the package.

i.e. for the 64bit compiling.
it expects the libmySQL.dll to be in "${MYSQL_HOME}"/bin/libmySQL.dll
so simply copy the dll over to the /bin dir and it will now compile.

for the 32bit compilling.
the libmySQL.lib is expected in "${MYSQL_HOME}"/lib/opt/libmysql.lib
again moving this should solve the problem.

Alternatively, if you don't want to or can't move these files. Then you can edit the source code files:
Makevars.win
Makevars.win32
Makevars.win64
appropriately pointing to /lib/libmysql.dll /lib/libmysql.lib

一百个冬季 2024-10-21 04:47:53

将 MySQL 和 RTools 目录添加到 PATH!

这是我的路径 ; ~blah~;C:\Program Files\MySQL\MySQL Server 5.5\bin;c:\rtools\bin;C:\Rtools\gcc-4.6.3\bin;

Add MySQL and RTools directory to the PATH!

Here is my PATH ; ~blah~;C:\Program Files\MySQL\MySQL Server 5.5\bin;c:\rtools\bin;C:\Rtools\gcc-4.6.3\bin;

╄→承喏 2024-10-21 04:47:53

我花了两天时间使用 RMySQL 软件包安装 R,终于找到了解决方案,以下是安装 RMySQL 软件包的步骤:-

  1. 从以下链接下载软件:
    *一个。 R2.13.2:从 http://cran.stat.sfu.ca/index.html< 下载 R /a>

    <前><代码> b. RTools 214:从 http://cran.cict.fr 下载 RTools

    c. RMySQL 0.8-0.tar.gz:从以下位置下载 RMySQL
    http://biostat.mc.vanderbilt.edu/wiki/main/RMySQL/RMySQL_0.8-0.tar.gz

    d. MySQL Server 5.0:从http://dev.mysql.com下载

    e. RSTUDIO(可选):从 http://rstudio.org* 下载

  2. 设置以下环境变量

    <前><代码> * a. MYSQL_HOME :/MySQL 安装文件夹的路径
    例如 MYSQL_HOME= C:\Program Files\MySQL\MySQL Server 5.5\

    b. R_HOME:<驱动器>/R 安装路径
    例如 R_HOME=C:\Program Files\R\R-2.13.2\

    c. PATH:修改路径以容纳上述变量。 *

    确保以下路径包含在您的 Windows PATH 变量中:
    \Rtools\2.14\bin
    \Rtools\2.14\MinGW\bin
    \Rtools\2.14\MinGW64\bin

  3. 创建文件夹并复制文件

    a. OPT:在C:\Program Files\MySQL\MySQL Server 5.5\lib下创建文件夹OPT并复制
    MYSQLLIB.LIB 上面的路径。还将 libmysql.dll 复制到 \\R\R-2.14.0\bin\ (64 位)或 \\R\R-2.14.0\bin\i386\ (32 位)和 C:\Windows\System32。

b. Renviron.site:创建或编辑文件 \\R\R-2.14.0\etc\Renviron.site 并添加
行:MYSQL_HOME =”C:/Program Files/MySQL/MySQL Server 5.5/”
注意:此处使用正斜杠和双引号

c. libMySQL.dll:将此文件复制到 C:\Program Files\R\R-2.13.2\bin\i386 以及 C:\Program
文件\R\R-2.13.2\bin

  1. 运行命令

    a. Install.Packages:通过单击桌面上的 R 图标或从“开始”菜单运行 R GUI。类型
    INSTALL.PACKAGES(“RMySQL”,类型=“源”)。这将从存储库下载所需的软件。

b.命令提示符:复制下载的 zip 文件(在步骤 4.a 中)并将其粘贴到 R 下
安装文件夹。转到开始菜单并打开命令提示符。转到 R 安装文件夹并输入 R CMD INSTALL RMySQL_0.8-0.tar.gz

  *COMMANDS:
  >library(RMySQL)
   >drv = dbDriver("MySQL")
   >con = dbConnect(drv,host="localhost",dbname="test",user="root",pass="root")
   >album = dbGetQuery(con,statement="select * from t_master")
   >album*

I was working for last 2 days on Installation of R with RMySQL package, finally got the solution for that, here are the steps to install RMySQL package:-

  1. DOWNLOAD SOFTWARE FROM THE FOLLOWING LINKS:
    *a. R2.13.2: Download R from http://cran.stat.sfu.ca/index.html

      b. RTools 214:  Download RTools from http://cran.cict.fr
    
      c. RMySQL 0.8-0.tar.gz: Download RMySQL from 
      http://biostat.mc.vanderbilt.edu/wiki/main/RMySQL/RMySQL_0.8-0.tar.gz
    
      d. MySQL Server 5.0: download it from http://dev.mysql.com
    
      e. RSTUDIO (optional): download it from http://rstudio.org*
    
  2. SET THE FOLLOWING ENVIRONMENT VARIABLES

     * a. MYSQL_HOME : <drive>/path to MySQL installation folder
          e.g. MYSQL_HOME= C:\Program Files\MySQL\MySQL Server 5.5\ 
    
      b. R_HOME: <drive>/path to R installation
         e.g. R_HOME=C:\Program Files\R\R-2.13.2\
    
      c. PATH: Modify path to accommodate the above variables. *
    

    Be sure that the following paths areincluded in your Windows PATH variable:
    \Rtools\2.14\bin
    \Rtools\2.14\MinGW\bin
    \Rtools\2.14\MinGW64\bin

  3. CREATE FOLDER AND COPY FILES

    a. OPT: Create a folder OPT under C:\Program Files\MySQL\MySQL Server 5.5\lib and copy
    MYSQLLIB.LIB the above path. Also copy libmysql.dll to \\R\R-2.14.0\bin\ (64 bit) Or \\R\R-2.14.0\bin\i386\ (32 bit) and to C:\Windows\System32.

b. Renviron.site: create or edit a file \\R\R-2.14.0\etc\Renviron.site and add a
line: MYSQL_HOME =”C:/Program Files/MySQL/MySQL Server 5.5/”
NB: USE FORWARD SLASH AND DOUBLE QUOTES HERE

c. libMySQL.dll: Copy this file to C:\Program Files\R\R-2.13.2\bin\i386 as well as C:\Program
Files\R\R-2.13.2\bin

  1. RUN COMMANDS

    a. Install.Packages: Run R GUI by clicking on the R icon on desktop or from Start menu. Type
    INSTALL.PACKAGES(“RMySQL”,type=”Sources”). This will download the required software from repositories.

b. Command Prompt: Copy the downloaded zip file (in step 4.a.) and paste it under R
installation folder. Go to start menu and open Command Prompt. Go to the R installation folder and type R CMD INSTALL RMySQL_0.8-0.tar.gz

  *COMMANDS:
  >library(RMySQL)
   >drv = dbDriver("MySQL")
   >con = dbConnect(drv,host="localhost",dbname="test",user="root",pass="root")
   >album = dbGetQuery(con,statement="select * from t_master")
   >album*
北方。的韩爷 2024-10-21 04:47:53

18 个月后,新笔记本电脑,同样的问题。回到犯罪现场——对不起2011年1月的自己;我们身处未来,但这个装置仍然没有任何乐趣。

经验教训:

- 更新的 RTools 是必不可少的。获取它们

- 您是否看到类似 .onLoad failed in loadNamespace() for 'RMySQL', details 的错误?这似乎意味着您的系统环境变量有问题。

在 R 中,运行

Sys.getenv('MYSQL_HOME')

如果它返回一条路径,就像

 [1] "C:\\Program Files\\MySQL\\MySQL Server 5.6"

你很好一样。但如果它给你空字符串,你需要设置它。

这些都是 Windows 7 的说明,但如果没记错的话,XP 中的过程非常相似。

1) 调出系统属性>高级>环境变量。

2) 在下方的“系统变量”窗格中,单击“新建”。

3)变量名称是MYSQL_HOME,值是MySQL安装的路径 - 我的是C:\Program Files\MySQL\MySQL Server 5.6

较新版本的MySQL不适用似乎没有在安装时创建环境变量 - 这以及 RMySQL 二进制文件的缺乏解释了为什么这个问题获得了 8,000 次点击。

-还卡住了吗?这里有另外两篇深入的文章:12

18 months later, new laptop, same problem. Returning to the scene of the crime - sorry January 2011 self; we're in the future, and this installation still isn't any fun.

Lessons learned:

-Updated RTools are essential. Get them.

-Are you seeing an error along the lines of .onLoad failed in loadNamespace() for 'RMySQL', details? This seems to mean that there's a problem with your system environment variables.

In R, run

Sys.getenv('MYSQL_HOME')

If it spits back a path like

 [1] "C:\\Program Files\\MySQL\\MySQL Server 5.6"

you're good. But if it gives you empty string, you need to set this.

These are all Windows 7 directions, but the process is pretty similar in XP, if memory serves.

1) Bring up System Properties > Advanced > Environment Variables.

2) In the lower 'System Variables' pane, click 'New'.

3) Variable name is MYSQL_HOME and value is whatever the path is to your MySQL installation - mine was C:\Program Files\MySQL\MySQL Server 5.6

Newer versions of MySQL don't seem to create an environment variable on install - that and the lack of binaries for RMySQL explain why this questions has garnered 8,000 hits.

-Still stuck? Here are two additional in-depth writeups: 1, 2

滿滿的愛 2024-10-21 04:47:53

以下在 Red Hat Linux 中为我工作

wget http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz
sudo R CMD INSTALL  --configure-args='--with-mysql-inc=/usr/include/mysql' --configure-args='--with-mysql-lib=/usr/lib64/mysql' RMySQL_0.9-3.tar.gz

Following worked for me in red hat linux

wget http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz
sudo R CMD INSTALL  --configure-args='--with-mysql-inc=/usr/include/mysql' --configure-args='--with-mysql-lib=/usr/lib64/mysql' RMySQL_0.9-3.tar.gz
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文