【问题标题】:mysql connector c++ install on raspberryPimysql连接器c ++安装在树莓派上
【发布时间】:2015-07-02 23:17:34
【问题描述】:

我想在我的树莓派上设置连接器/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”

然后我尝试从源代码安装最新的软件包: https://dev.mysql.com/downloads/connector/cpp/ 位于 ->Source Code -> Generic Linux (Architecture Independent), Compressed TAR Archive

我下载了它并执行了“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://packages.debian.org/jessie/armhf/libmysqlcppconn-dev/download

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).

这是好事还是坏事?

【问题讨论】:

    标签: c++ mysql installation raspberry-pi


    【解决方案1】:

    需要安装MySQL客户端库开发文件:

    apt-get install libmysqlclient-dev
    

    一种更简单的尝试并确保您已安装所有依赖项的方法是要求 apt 为其打包版本安装所有构建依赖项:

    apt-get build-dep libmysqlcppconn-dev
    

    【讨论】:

    • 是的,我已经安装了 libmysqlclient-dev,但它没有工作。而且我不认为'apt-get build-dep libmysqlcppconn-dev'会更好,因为我从'apt-get'获得的最新版本的cppconn-dev是错误版本1.1.0-4而不是更新版本1.1.5 我需要。但是到目前为止,谢谢
    【解决方案2】:

    libmysqlclient-dev 包不再存在。估计改名了所以要安装 c++ 连接器,有这个新包:

    sudo apt install libmysql++-dev
    

    【讨论】:

      猜你喜欢
      • 2016-10-26
      • 2021-01-18
      • 1970-01-01
      • 2015-12-10
      • 2021-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多