I have installed R3.0.1. Rtools is also installed. MySQL version 5.7 is installed. I want to connect R to MySQL, and I am trying to do that through RMySQL package in R.
While the installation of RMySQL is finally done after looking at various SO questions, the library command gives error. Please see below complete R logs. Please help.
> install.packages("RMySQL",type="source")
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.7
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: D:/SOFTWA~1/R-30~1.3/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/d/SOFTWA~1/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"D:/SOFTWA~1/R-30~1.3/include" -DNDEBUG -I"C:/Program Files/MySQL/MySQL Server 5.7"/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"D:/SOFTWA~1/R-30~1.3/include" -DNDEBUG -I"C:/Program Files/MySQL/MySQL Server 5.7"/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.7/bin/libmySQL.dll - Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LD:/SOFTWA~1/R-30~1.3/bin/x64 -lR
installing to D:/Softwares/R-3.0.3/library/RMySQL/libs/x64
** R
** inst
** preparing package for lazy loading
Creating a generic function for 'format' from package 'base' in package 'RMySQL'
Creating a generic function for 'print' from package 'base' in package 'RMySQL'
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
MYSQL_HOME defined as C:/Program Files/MySQL/MySQL Server 5.7
* DONE (RMySQL)
The downloaded source packages are in
‘C:\Users\mitrabhanu.panda\AppData\Local\Temp\RtmpgZHT8R\downloaded_packages’
> library(RMySQL)
Looking in C:\Program Files/MySQL, C:/MySQL, D:/MySQL, E:/MySQL, F:/MySQL, G:/MySQL, C:/xampp/MySQL, D:/xampp/MySQL, E:/xampp/MySQL, F:/xampp/MySQL, G:/xampp/MySQL, C:/Apps/MySQL, D:/Apps/MySQL, E:/Apps/MySQL, F:/Apps/MySQL, G:/Apps/MySQL
Found C:\Program Files/MySQL
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
call: setwd(bin)
error: character argument expected
Error: package or namespace load failed for ‘RMySQL’
Please let me know what I have done wrong.
As written in my comment, here is the sample code for reading a table from mysql:
require(RJDBC)
j <- JDBC(classPath='/path/to/mysql/jdbc/jar', driverClass='com.mysql.jdbc.Driver')
connection <- dbConnect(j, 'jdbc:mysql://localhost/databasename', 'myusername','mypassword')
on.exit(dbDisconnect(connection))
data.frame.from.sql <- dbReadTable(connection, 'tablename')
This will read the table named tablename from databasename into data.frame.from.sql as an R data frame that you can manipulate as you see fit. I hope this helps.
Related
i want to use mysql in lua program. But when run require "luasql.mysql",
throws error infomation
error loading module 'luasql.mysql' from file '/usr/local/luarocks/lib/lua/5.4/luasql/mysql.so':
/usr/local/luarocks/lib/lua/5.4/luasql/mysql.so:1: unexpected symbol near '<\207>'
stack traceback:
[C]: in ?
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
I install lua and mysql by brew.
which lua is /opt/homebrew/bin/lua, lua -v is Lua 5.4.3 Copyright (C) 1994-2021 Lua.org, PUC-Rio
which mysql is /opt/homebrew/bin/mysql, mysql -V is mysql Ver 8.0.23 for osx10.16 on x86_64 (Homebrew)
install luarocks by luarocks source code, this is the source code website (https://luarocks.github.io/luarocks/releases/ ), luarocks --version is
/usr/local/luarocks/bin/luarocks 3.9.1
LuaRocks main command-line interface
which luarocks is /usr/local/bin/luarocks
Install luasql-mysql by command
luarocks install luasql-mysql MYSQL_INCDIR=/opt/homebrew/Cellar/mysql/8.0.23_1/include/mysql MYSQL_LIBDIR=/opt/homebrew/Cellar/mysql/8.0.23_1/lib
and then the result is
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -fPIC -I/opt/homebrew/include/lua5.4 -c src/luasql.c -o src/luasql.o -I/opt/homebrew/Cellar/mysql/8.0.23_1/include/mysql
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -fPIC -I/opt/homebrew/include/lua5.4 -c src/ls_mysql.c -o src/ls_mysql.o -I/opt/homebrew/Cellar/mysql/8.0.23_1/include/mysql
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -bundle -undefined dynamic_lookup -all_load -o luasql/mysql.so src/luasql.o src/ls_mysql.o -L/opt/homebrew/Cellar/mysql/8.0.23_1/lib -lmysqlclient
luasql-mysql 2.6.0-1 is now installed in /usr/local/luarocks (license: MIT/X11)
run luarocks list, the result is
Rocks installed for Lua 5.4
---------------------------
luarocks
3.9.1-1 (installed) - /usr/local/luarocks/lib/luarocks/rocks-5.4
luasql-mysql
2.6.0-1 (installed) - /usr/local/luarocks/lib/luarocks/rocks-5.4
I config export LUA_PATH="/usr/local/luarocks/lib/lua/5.4/?.so;;" in .zshrc profile. When execute print(package.path), the output is
/usr/local/luarocks/lib/lua/5.4/?.so;/opt/homebrew/share/lua/5.4/?.lua;/opt/homebrew/share/lua/5.4/?/init.lua;/opt/homebrew/lib/lua/5.4/?.lua;/opt/homebrew/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua
so run require "luasql.mysql", i don't know the reason about
error loading module...
how should i solve this problem, is anyone knows?
i expected anyone else tell me how to solve this problem
I am trying to compile MariaDB Connector v1.0.5 and/or Mysql Connection v 5.3.4.
I have MariaDB Server v.10.0.21 installed on a Slackware server. I just need to get a MYSQL connector working, doesn't matter which one.
Also applied the patch mentioned in Is there compatible ODBC driver with Mariadb 10 on Linux?
When I compile the MariaDB Connector I get an error saying "MariaDB not found".
When I compile the Mysql Connector I get the following error:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MYSQL_LIB
linked by target "myodbc5a" in directory /downloads/mysql-connector-odbc-5.3.4-src/driver
linked by target "myodbc5w" in directory /downloads/mysql-connector-odbc-5.3.4-src/driver
linked by target "myodbc5S" in directory /downloads/mysql-connector-odbc-5.3.4-src/setupgui
linked by target "myodbc-installer" in directory /downloads/mysql-connector-odbc-5.3.4-src/installer
OUTOUT from Error File
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec3523358880/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec3523358880.dir/build.make CMakeFiles/cmTryCompileExec3523358880.dir/build
gmake1: Entering directory /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3523358880.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec3523358880.dir/CheckFunctionExists.c.o -c /usr/share/cmake-2.8/Modules/CheckFunct
ionExists.c
Linking C executable cmTryCompileExec3523358880
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3523358880.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec3523358880.dir/CheckFunctionExists.c.o -o cmTryCompileExec3523358880 -rdynamic -lpth
reads
/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec3523358880] Error 1
gmake[1]: Leaving directory/downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3523358880/fast] Error 2
Determining if the function dlopen exists failed with the following output:
Change Dir: /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec1888052970/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1888052970.dir/build.make CMakeFiles/cmTryCompileExec1888052970.dir/build
gmake1: Entering directory /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=dlopen -o CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o -c /usr/share/cmake-2.8/Modules/CheckFunctionExist
s.c
Linking C executable cmTryCompileExec1888052970
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1888052970.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=dlopen CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o -o cmTryCompileExec1888052970 -rdynamic
CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o: In functionmain':
CheckFunctionExists.c:(.text+0x15): undefined reference to dlopen'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec1888052970] Error 1
gmake[1]: Leaving directory/downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec1888052970/fast] Error 2
Blockquote
Just use the precompiled versions. Copy the libraries to the lib and include directories.
I'm trying to install mysql using:
cpanm DBD::mysql
I got output error like this: Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on DBD::mysql
Fetching http: //www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.025.tar.gz ... OK
Configuring DBD-mysql-4.025 ... OK
Building and testing DBD-mysql-4.025 ... FAIL
! Installing DBD::mysql failed. See C:\Users\myuser\cpanm\work\1384776992.9536\build.log for details. Retry with --force to force install it
When I opened the log file to check the detail, it's as bellows. Is there anyone help me out:
cpanm (App::cpanminus) 1.7001 on perl 5.012004 built for MSWin32-x86-multi-thread
Work directory is C:\Users\myuser/.cpanm/work/1384776992.9536
You have make C:\Perl\site\bin\dmake.exe
You have LWP 6.02
Falling back to Archive::Tar 1.76
Searching DBD::mysql on cpanmetadb ...
--> Working on DBD::mysql
Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.025.tar.gz
-> OK
Unpacking DBD-mysql-4.025.tar.gz
Entering DBD-mysql-4.025
Checking configure dependencies from META.yml
Checking if you have DBI 1.08 ... Yes (1.616)
Configuring DBD-mysql-4.025
Running Makefile.PL
Set up gcc environment - 3.4.5 (mingw-vista special r3)
mysql_config.pl, and an associated bat file, has been
successfully created under
C:\PROGRA~1\MySQL\MYSQLS~1.1\bin
Unknown option: testdb
Unknown option: testhost
Unknown option: testuser
PLEASE NOTE:
For 'make test' to run properly, you must ensure that the
database user '' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.
mysql> grant all privileges on test.* to ''#'localhost' identified by 's3kr1t';
You can also optionally set the user to run 'make test' with:
perl Makefile.PL --testuser=username
Unknown option: testpassword
Unknown option: testsocket
Unknown option: testport
Unknown option: nocatchstderr
Unknown option: ssl
Unknown option: nofoundrows
Unknown option: force-embedded
I will use the following settings for compiling and testing:
cflags (mysql_config) = -I"C:\PROGRA~1\MySQL\MYSQLS~1.1\include"
embedded (mysql_config) =
ldflags (mysql_config) =
libs (mysql_config) = -LC:\PROGRA~1\MySQL\MYSQLS~1.1\lib\opt -lmysqlclient -lzlib
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testport (default ) =
testsocket (default ) =
testuser (guessed ) =
To change these settings, see 'perl Makefile.PL --help' and
'perldoc DBD::mysql::INSTALL'.
Checking if your kit is complete...
Warning: the following files are missing in your kit:
META.json
t/mem_leak.pl
Please inform the author.
Note (probably harmless): No library found for -lmysqlclient
Note (probably harmless): No library found for -lzlib
Using DBI 1.616 (for perl 5.012004 on MSWin32-x86-multi-thread) installed in C:/Perl/lib/auto/DBI/
Writing Makefile for DBD::mysql
-> OK
Finding PREREQ from Makefile ...
Checking if you have Test::More 0 ... Yes (0.98)
Checking if you have Data::Dumper 0 ... Yes (2.128)
Checking if you have Test::Deep 0 ... Yes (0.110)
Checking if you have DBI 1.08 ... Yes (1.616)
Building and testing DBD-mysql-4.025
cp lib/DBD/mysql.pm blib\lib\DBD\mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib\lib\DBD\mysql\GetInfo.pm
cp README.pod blib\lib\DBD\README.pod
cp lib/DBD/mysql/INSTALL.pod blib\lib\DBD\mysql\INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib\lib\Bundle\DBD\mysql.pm
C:/Perl/site/bin/gcc.exe -c -IC:\Perl\lib\auto\DBI -I"C:\PROGRA~1\MySQL\MYSQLS~1.1\include" - DDBD_MYSQL_INSERT_ID_IS_GOOD -g -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields -O2 -DVERSION=\"4.025\" -DXS_VERSION=\"4.025\" "-IC:\Perl\lib\CORE" dbdimp.c
In file included from dbdimp.c:18:
dbdimp.h:21:49: mysql.h: No such file or directory
dbdimp.h:22:45: mysqld_error.h: No such file or directory
dbdimp.h:24:49: errmsg.h: No such file or directory
In file included from dbdimp.c:18:
dbdimp.h:157: error: syntax error before "MYSQL"
dbdimp.h:157: warning: no semicolon at end of struct or union
dbdimp.h:180: error: syntax error before '}' token
dbdimp.h:255: error: syntax error before "MYSQL_RES"
dbdimp.h:255: warning: no semicolon at end of struct or union
dbdimp.h:258: error: syntax error before "row_num"
dbdimp.h:258: warning: data definition has no type or storage class
dbdimp.h:263: error: syntax error before "insertid"
dbdimp.h:263: warning: data definition has no type or storage class
dbdimp.h:267: error: conflicting types for 'use_mysql_use_result'
dbdimp.h:165: error: previous declaration of 'use_mysql_use_result' was here
dbdimp.h:274: error: syntax error before '}' token
...............................................
-> FAIL Installing DBD::mysql failed. See C:\Users\wangw35\.cpanm\work\1384776992.9536\build.log for details. Retry with --force to force install it.
These are the two important lines.
Note (probably harmless): No library found for -lmysqlclient
Note (probably harmless): No library found for -lzlib
You need to install the mysqlclient (and also zlib) on your system.
I used this guide: Using MySQL in R for Windows but it didn't help. I'm already searching for hours on this problem. Since I can't figure out my problem I just can send here the log when trying to 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’
I think the main problem is in "collect2: ld returned 5 exit status". Well maybe you guys can help me out. Overall I just want to connect R-Studio with a MySQL database. Thanks.
Found the solution. It's pretty easy.
Go to R-Studio -> Tools -> Options -> R-Version -> and here instead of the current choose "[Default] [32-bit] C:\Program Files\R\R-3.0.2"
Now it works for the issue above. Have fun.
Use RODBC and this guide: http://www.joyofdata.de/blog/make-r-talk-to-mysql-on-windows/
You are using R 64bit apparently - it is important to then use the 64bit connector.
I remember, years ago when I started using mySQL, it was a nightmare to set up things "just so," so that the libraries were found (especially mySQL libraries!). In my case, I believe ldconfig was the tool that sorted things out. Flash forward to 2012 - have just installed a new "primary" system that includes 64-bit Ubuntu 12.04, and I'm in the process of making sure all my sources will compile. Imagine my surprise that I'm back in the same boat with libmysqlclient.
My web searches have revealed much to try, nothing that helps. Along the way, I found this trick: gcc ... mysql_config --cflags --libs - very nice, but that didn't help.
So, for example, the result of:
gcc -D_FILE_OFFSET_BITS=64 `mysql_config --cflags --libs` \
-o check-my-ip \
-s check-my-ip.c ../common/ini-file.c
is
/tmp/ccxAgCqr.o: In function `updateTables':
/usr/local/src/check-my-ip/check-my-ip.c:373: undefined reference to `mysql_init'
/usr/local/src/check-my-ip/check-my-ip.c:374: undefined reference to `mysql_real_connect'
/usr/local/src/check-my-ip/check-my-ip.c:381: undefined reference to `mysql_error'
/usr/local/src/check-my-ip/check-my-ip.c:381: undefined reference to `mysql_errno'
/usr/local/src/check-my-ip/check-my-ip.c:397: undefined reference to `mysql_field_count'
/usr/local/src/check-my-ip/check-my-ip.c:398: undefined reference to `mysql_use_result'
/usr/local/src/check-my-ip/check-my-ip.c:399: undefined reference to `mysql_fetch_row'
/usr/local/src/check-my-ip/check-my-ip.c:419: undefined reference to `mysql_free_result'
/usr/local/src/check-my-ip/check-my-ip.c:422: undefined reference to `mysql_field_count'
/usr/local/src/check-my-ip/check-my-ip.c:429: undefined reference to `mysql_close'
/tmp/ccxAgCqr.o: In function `myQuery':
/usr/local/src/check-my-ip/check-my-ip.c:439: undefined reference to `mysql_query'
/usr/local/src/check-my-ip/check-my-ip.c:441: undefined reference to `mysql_error'
/tmp/ccxAgCqr.o: In function `indexExists':
/usr/local/src/check-my-ip/check-my-ip.c:464: undefined reference to `mysql_field_count'
/usr/local/src/check-my-ip/check-my-ip.c:465: undefined reference to `mysql_use_result'
/usr/local/src/check-my-ip/check-my-ip.c:466: undefined reference to `mysql_fetch_row'
/usr/local/src/check-my-ip/check-my-ip.c:471: undefined reference to `mysql_free_result'
collect2: ld returned 1 exit status
make: *** [check-my-ip] Error 1
Output from mysql_config --cflags --libs is:
-I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g
-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl
These are some other commands that may be helpful in diagnosis:
$ ldconfig -p | grep mysql
libmysqlclient.so.18 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
libmysqlclient.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmysqlclient.so
$ ls -l /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
lrwxrwxrwx 1 root root 24 Jun 11 10:21 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
$ ls -l /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
-rw-r--r-- 1 root root 3408136 Jun 11 10:21 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
I did an aptitude search libmysql and noted that there are 37 lines, most of which have the i386 designation (like: libmysqld-pic:i386),
and I notice that there are zero lines with x86_64 (or -64) in that output; is that part of the problem? (Here are those 37 lines)
$ aptitude search libmysql
p libmysql++-dev - MySQL C++ library bindings (development)
p libmysql++-dev:i386 - MySQL C++ library bindings (development)
p libmysql++-doc - MySQL C++ library bindings (documentation and exampl
p libmysql++3 - MySQL C++ library bindings (runtime)
p libmysql++3:i386 - MySQL C++ library bindings (runtime)
p libmysql-cil-dev - MySQL database connector for CLI
p libmysql-diff-perl - module for comparing the table structure of two MySQ
p libmysql-java - Java database (JDBC) driver for MySQL
p libmysql-ocaml - OCaml bindings for MySql
p libmysql-ocaml:i386 - OCaml bindings for MySql
p libmysql-ocaml-dev - OCaml bindings for MySql
p libmysql-ocaml-dev:i386 - OCaml bindings for MySql
v libmysql-ocaml-dev-dnim6:i386 -
v libmysql-ocaml-dev-jygp6 -
v libmysql-ocaml-dnim6:i386 -
v libmysql-ocaml-jygp6 -
p libmysql-ruby - Transitional package for ruby-mysql
v libmysql-ruby:i386 -
p libmysql-ruby1.8 - Transitional package for ruby-mysql
v libmysql-ruby1.8:i386 -
p libmysql-ruby1.9.1 - Transitional package for ruby-mysql
v libmysql-ruby1.9.1:i386 -
p libmysql6.4-cil - MySQL database connector for CLI
i libmysqlclient-dev - MySQL database development files
p libmysqlclient-dev:i386 - MySQL database development files
v libmysqlclient15-dev -
v libmysqlclient15-dev:i386 -
i A libmysqlclient18 - MySQL database client library
p libmysqlclient18:i386 - MySQL database client library
p libmysqlcppconn-dev - MySQL Connector for C++ (development files)
p libmysqlcppconn-dev:i386 - MySQL Connector for C++ (development files)
p libmysqlcppconn5 - MySQL Connector for C++ (library)
p libmysqlcppconn5:i386 - MySQL Connector for C++ (library)
i libmysqld-dev - MySQL embedded database development files
p libmysqld-dev:i386 - MySQL embedded database development files
p libmysqld-pic - MySQL database development files
p libmysqld-pic:i386 - MySQL database development files
Here's the content of /usr/lib/mysql
$ find /usr/lib/mysql
/usr/lib/mysql
/usr/lib/mysql/plugin
/usr/lib/mysql/plugin/qa_auth_client.so
/usr/lib/mysql/plugin/auth.so
/usr/lib/mysql/plugin/qa_auth_server.so
/usr/lib/mysql/plugin/semisync_master.so
/usr/lib/mysql/plugin/libdaemon_example.so
/usr/lib/mysql/plugin/ha_example.so
/usr/lib/mysql/plugin/adt_null.so
/usr/lib/mysql/plugin/auth_test_plugin.so
/usr/lib/mysql/plugin/auth_socket.so
/usr/lib/mysql/plugin/qa_auth_interface.so
/usr/lib/mysql/plugin/semisync_slave.so
/usr/lib/mysql/plugin/mypluglib.so
I don't know what else to try, where else to look, and would appreciate any pointers.
Linker flags should always be specified last:
gcc -D_FILE_OFFSET_BITS=64 `mysql_config --cflags` \
-o check-my-ip \
-s check-my-ip.c ../common/ini-file.c \
`mysql_config --libs`