Skip to content

RMySQL install on windows

4 messages · Gabor Grothendieck, Greg Snow, Robert Baer

#
I have been trying to install RMySQL on Windows 7 following the 
procedure at:
http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

I think I have properly installed RTools and created a proper 
Renviron.site file saying:
MYSQL_HOME="C:/Program Files/MySQL/MySQL Server 5.5"

When I try to install the packages from source, I get warnings that 
suggest I'm still not quite "with the program" yet. There are comments 
about POSIX paths that I don't quite grasp. Can anyone give me 
additional hints?

There seems to be a libmysql.dll in the /lib subdirectory although the 
install seems to be looking in the /bin directory for a file of similar 
name. Is this something that has changed with recent versions of MySQL 
that should be fixed in the RMySQL package or is it something I can work 
around by hand or by properly setting some environmental variable?

Thanks,

Rob

The errors ...

 > install.packages('RMySQL',type='source')
trying URL 'http://cran.wustl.edu/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.5
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-215~1.1/etc/x64/Makeconf
Preferred POSIX equivalent is: 
/cygdrive/c/PROGRA~1/R/R-215~1.1/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-215~1.1/include" -DNDEBUG -I"C:/Program 
Files/MySQL/MySQL Server 5.5"/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-215~1.1/include" -DNDEBUG -I"C:/Program 
Files/MySQL/MySQL Server 5.5"/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.5/bin/libmySQL.dll 
-Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 
-Ld:/RCompile/CRANpkg/extralibs64/local/lib 
-LC:/PROGRA~1/R/R-215~1.1/bin/x64 -lR
gcc.exe: error: C:/Program Files/MySQL/MySQL Server 
5.5/bin/libmySQL.dll: No such file or directory
ERROR: compilation failed for package 'RMySQL'
* removing 'C:/Program Files/R/R-2.15.1/library/RMySQL'

The downloaded source packages are in
?C:\Users\rbaer\AppData\Local\Temp\Rtmps9adPQ\downloaded_packages?
Warning messages:
1: running command 'C:/PROGRA~1/R/R-215~1.1/bin/x64/R CMD INSTALL -l 
"C:/Program Files/R/R-2.15.1/library" 
C:\Users\rbaer\AppData\Local\Temp\Rtmps9adPQ/downloaded_packages/RMySQL_0.9-3.tar.gz' 
had status 1
2: In install.packages("RMySQL", type = "source") :
installation of package ?RMySQL? had non-zero exit status
 > R.Version()
$platform
[1] "x86_64-pc-mingw32"

$arch
[1] "x86_64"

$os
[1] "mingw32"

$system
[1] "x86_64, mingw32"

$status
[1] ""

$major
[1] "2"

$minor
[1] "15.1"

$year
[1] "2012"

$month
[1] "06"

$day
[1] "22"

$`svn rev`
[1] "59607"

$language
[1] "R"

$version.string
[1] "R version 2.15.1 (2012-06-22)"

$nickname
[1] "Roasted Marshmallows"
#
On Tue, Oct 9, 2012 at 5:08 PM, Robert Baer <rbaer at atsu.edu> wrote:
Most people who have problems have them because they followed
instructions on the internet rather than the ones that come with the
package.  Go to:
http://cran.r-project.org/web/packages/RMySQL/index.html
and click on the Installation link (or download the source and read
the INSTALL file).
#
I finally was able to compile/load it under windows 7.  I had similar
problems to what you show below.

I set the MYSQL_HOME environmental variable through windows (start
button > control panel > System and Security > system > Advanced
System Settings > Environmental variables).  I had to set it to the
version of the path without spaces, in my case it was:
c:\PROGRA~1\MySQL\MYSQLS~1.5

Then I opened a command prompt window, changed to the directory where
I  had downloaded the tar.gz file from cran and entered the command:
"c:\Program Files\R\R-2.15.1\bin\x64\R" CMD INSTALL RMySQL_0.9-3.tar.gz

and everything worked (it did not work if I used i386 or just the
regular bin folder, possibly due to the version of MySQL I
downloaded).

Then I started a new instance of R and did library(MySQL) and
everything loaded and I was able to connect to a local MySQL database.

Hope this helps you as well.
On Tue, Oct 9, 2012 at 3:08 PM, Robert Baer <rbaer at atsu.edu> wrote:

  
    
2 days later
#
On 10/10/2012 12:58 PM, Greg Snow wrote:
Thanks, Greg.   I got a couple of warnings during the build, but I can 
at least load the library.  Now, I'll to to learn to use it<G>

I had downloaded the 64-bit MySQL engine.  The seemingly successful 
install was on R (64-bit).

I guess not unexpectedly I get the from R (i386)
 > library(RMySQL)
Error: package ?RMySQL? is not installed for 'arch=i386'

Appreciate the guidance.

Rob