我想在我的raspberry Pi上设置connector / c ++来访问mysql数据库。起初我试过了:
sudo apt-get install libmysqlcppconn-dev
已成功安装,但我收到错误:
ERR: MySQL_Connection::setReadOnly() (MySQL error code: 0, SQLState: )
附带cppconn我正在使用的版本,正如其中所述:MySQL Connector for C++ | MySQL_Connection::setReadOnly() exception on setSchema
当我检查时:
sudo apt-cache show libmysqlcppconn-dev
它说"版本:1.1.0-4"
然后我尝试从源代码安装最新的软件包: { - 3}}下的>源代码 - >通用Linux(独立于架构),压缩TAR存档
我下载了它并且做了" tar xvzf mysql -...."一切正常。但是当我尝试使用
构建它时cmake .
我收到了错误:
CMake Warning (dev) in CMakeLists.txt:
Syntax Warning in cmake code at
/home/pi/quadro/mysql-connector/CMakeLists.txt:114:24
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Syntax Warning in cmake code at
/home/pi/quadro/mysql-connector/CMakeLists.txt:114:54
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
-- mysql_config was found /etc/mysql
CMake Error at FindMySQL.cm:165 (MESSAGE):
mysql_config wasn't found, -DMYSQL_CONFIG_EXECUTABLE=...
Call Stack (most recent call first):
CMakeLists.txt:55 (INCLUDE)
CMake Error at FindMySQL.cm:167 (MESSAGE):
Cannot find MySQL. Include dir: MYSQL_INCLUDE_DIR-NOTFOUND library dir:
cxxflags:
Call Stack (most recent call first):
CMakeLists.txt:55 (INCLUDE)
-- Configuring incomplete, errors occurred!
See also "/home/pi/quadro/mysql-connector/CMakeFiles/CMakeOutput.log".
我知道这意味着,它无法找到mysql_config,但我也不知道如何告诉它文件的位置,也不知道文件的实际位置。
所以请帮助我。我很讨厌这个。
非常感谢。
编辑:
我尝试手动安装最新的软件包,我从以下网址下载:
https://dev.mysql.com/downloads/connector/cpp/
sudo dpkg -i libmysqlcppconn7_1.1.3-6_armhf.deb
sudo dpkg -i libmysqlcppconn-dev_1.1.3-6_armhf.deb
现在我明白了:
$ sudo apt-cache show libmysqlcppconn-dev
Package: libmysqlcppconn-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 3213
Maintainer: Debian MySQL Maintainers <pkg-mysql- maint@lists.alioth.debian.org>
Architecture: armhf
Source: mysql-connector-c++
Version: 1.1.3-6
Depends: libboost-dev, libmysqlcppconn7 (= 1.1.3-6)
Description: MySQL Connector for C++ (development files)
MySQL Connector/C++ is a MySQL database connector for C++.
.
It mimics the JDBC 4.0 API.
.
This package contains the development files (headers, static library).
Package: libmysqlcppconn-dev
Source: mysql-connector-c++
Version: 1.1.0-4
Architecture: armhf
Maintainer: Debian MySQL Maintainers <pkg-mysql- maint@lists.alioth.debian.org>
Installed-Size: 3382
Depends: libboost-dev, libmysqlcppconn5 (= 1.1.0-4)
Homepage: http://forge.mysql.com/wiki/Connector_C++
Priority: optional
Section: libdevel
Filename: pool/main/m/mysql-connector-c++/libmysqlcppconn-dev_1.1.0- 4_armhf.deb
Size: 602550
SHA256: 286b6bf2ef3eb05dc8660a31780dd9af65c06f7d0d675257636281b2de056e15
SHA1: e53eeb1cf70c7522f557bbb6cbf0a753c6788fbb
MD5sum: 8770d029c21d086a48279c1f6e92f4a6
Description: MySQL Connector for C++ (development files)
MySQL Connector/C++ is a MySQL database connector for C++.
.
It mimics the JDBC 4.0 API.
.
This package contains the development files (headers, static library).
这是好还是坏?
答案 0 :(得分:1)
您需要安装MySQL客户端库开发文件:
apt-get install libmysqlclient-dev
尝试确保安装所有依赖项的更简单方法是要求apt为其打包版本安装所有构建依赖项:
apt-get build-dep libmysqlcppconn-dev
答案 1 :(得分:0)
libmysqlclient-dev
软件包已不存在。我猜它已重命名。因此,要安装c ++连接器,请使用以下新软件包:
sudo apt install libmysql++-dev