在 Mac Catalina 上安装 RMySQL 包

installing RMySQL package on Mac Catallina

我尝试在我的 Rstudio 中安装 RMySQL 包,当我尝试时,它给了我以下错误

> install.packages("RMySQL")
Installing package into ‘/Users/haeseongmoon/Library/R/3.6/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Package which is only available in source form, and may need compilation of
  C/C++/Fortran: ‘RMySQL’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘RMySQL’

trying URL 'https://cran.rstudio.com/src/contrib/RMySQL_0.10.20.tar.gz'
Content type 'application/x-gzip' length 52900 bytes (51 KB)
==================================================
downloaded 51 KB

* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lmysqlclient
-----------------------------[ ANTICONF ]-----------------------------
Configure could not find suitable mysql/mariadb client library. Try installing:
 * deb: libmariadbclient-dev | libmariadb-client-lgpl-dev (Debian, Ubuntu)
 * rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
 * csw: mysql56_dev (Solaris)
 * brew: mariadb-connector-c (OSX)
If you already have a mysql client library installed, verify that either
mariadb_config or mysql_config is on your PATH. If these are unavailable
you can also set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------[ ERROR MESSAGE ]----------------------------
<stdin>:1:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
         ^~~~~~~~~
1 error generated.
-----------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/Users/haeseongmoon/Library/R/3.6/library/RMySQL’
Warning in install.packages :
  installation of package ‘RMySQL’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/c6/qgbzrx0s4zq7gdbhzz43gqhw0000gn/T/RtmpOozjqL/downloaded_packages’

我尝试了在谷歌搜索时找到的各种解决方案,但没有成功。 如何安装 RMySQL?

谢天谢地,该错误会告诉您确切的操作。

Configure could not find suitable mysql/mariadb client library. Try installing:
 * deb: libmariadbclient-dev | libmariadb-client-lgpl-dev (Debian, Ubuntu)
 * rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
 * csw: mysql56_dev (Solaris)
 * brew: mariadb-connector-c (OSX)

您需要使用 homebrew 来安装 mariadb-connector-c

brew install mariadb-connector-c

如果您还没有自制软件,请查看 this page