installing RMySQL gives error RS-MySQL.h:32:19: fatal error: mysql.h: No such file

StackOverflow https://stackoverflow.com/questions/10270616

  •  02-06-2021
  •  | 
  •  

Question

I tried to install the RMySQL-library (R version 2.14.2, WinXP on 32bit) but got the following error message:

install.packages("D:/R/library/RMySQL_0.9-3.tar.gz",repos=NULL, type="source")

...

RS-MySQL.h:32:19: fatal error: mysql.h: No such file or directory
compilation terminated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package 'RMySQL'
* removing 'C:/Dokumente und Einstellungen/Giordano/R/win-library/2.14/RMySQL'
Warning message:
In install.packages("D:/R/library/RMySQL_0.9-3.tar.gz", repos = NULL,  :
  installation of package 'D:/R/library/RMySQL_0.9-3.tar.gz' had non-zero exit status

This is only a part of the output which contains the error message. I do not understand this message and maybe somebode can give me some advices. Thanks for help. giordano.

Was it helpful?

Solution

Some pointers to installing mysql header libraries are found here :

https://github.com/jeffreyhorner/RMySQL

(site seems to have moved here now)

http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

Key is to have a Renviron.site file in the R\etc folder and having libmysql.dll in the correct places before compiling from source.

good luck.

OTHER TIPS

R cannot find the MySQL header files that it needs to build the package. As the documentation states:

You need to have installed 'C Include Files / Lib Files' as part of your MySQL installation when installing the MySQL binary distribution.

The fix is to install the MySQL header files.

You will never get a RMySQL precompiled binary package for Windows, because before installing it checks for validity of the MySQL path & other include files.

I had this same issue. What I found out was that installer was placing temp files in my default working directory which I had edited in the Rprofile.site file. When it tried to subsequently use these files (including mysql.h) it could not find them. When I restored the Rprofile.site file to default, everything worked nicely. Hopefully this helps if nothing else did.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top