在 CentOs 7 上安装 libmysqlclient

在 CentOs 7 上安装 libmysqlclient

我正在尝试从 src 构建 mysql-shell 1.0.11。当我安装时,RPM 不是一个选项。要求之一是libmysqlclient 5.7+。我已经安装了mysql++mysql++-develmysql-connector-python.noarchmysql-workbench-community。当我尝试构建(Cmake)时,出现以下错误。

Could not find static "libmysqlclient_r.a libmysqlclient.a" in MYSQL_LIB_DIR

我需要安装什么才能使其正常工作?显然我需要 libmysqlclient,但 yum 中没有列出任何具有该名称或接近该名称的内容。

使用CentOs7。

TIA

答案1

尝试yum install mariadb-develCentOS 7

答案2

yum whatprovides 可以找到具有特定命令或 lib 的包,例如:

sudo yum whatprovides libmysqlclient*

1:mariadb-libs-5.5.56-2.el7.i686 : The shared libraries required for
                                 : MariaDB/MySQL clients
Repo        : base
Matched from:
Provides    : libmysqlclient.so.18
Provides    : libmysqlclient.so.18(libmysqlclient_16)
Provides    : libmysqlclient.so.18(libmysqlclient_18)

sudo yum install mariadb-libs-5.5.56-2.el7.i686

但我不确定从 src 安装 mysql-shell 是一个好主意,当你可以使用简单的方法时百胜安装 mysql

答案3

# find / -name libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so
# ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib64/libmysqlclient.so

答案4

# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 

安装包:

yum install mariadb mariadb-server mariadb-devel mariadb-libs luarocks lua-devel
yum group install "Development Tools"
luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql MYSQL_LIBDIR=/usr/lib64/mysql

终于得到了一些东西:

Installing https://luarocks.org/luasql-mysql-2.4.0-1.src.rock...
Using https://luarocks.org/luasql-mysql-2.4.0-1.src.rock... switching to 'build' mode
gcc -O2 -fPIC -I/usr/include -c src/luasql.c -o src/luasql.o -I/usr/include/mysql
gcc -O2 -fPIC -I/usr/include -c src/ls_mysql.c -o src/ls_mysql.o -I/usr/include/mysql
gcc -shared -o luasql/mysql.so -L/usr/lib64/lua/5.1 src/luasql.o src/ls_mysql.o -L/usr/lib64/mysql -Wl,-rpath,/usr/lib64/mysql: -lmysqlclient
Updating manifest for /usr/lib64/luarocks/rocks
No existing manifest. Attempting to rebuild...
luasql-mysql 2.4.0-1 is now built and installed in /usr (license: MIT/X11)

安装:

# luarocks list
Installed rocks:
----------------
luasql-mysql
   2.4.0-1 (installed) - /usr/lib64/luarocks/rocks

相关内容