在raspberryPi上安装mysql连接器c ++ [英] mysql connector c++ install on raspberryPi

查看:245
本文介绍了在raspberryPi上安装mysql连接器c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的树莓派上设置连接器/c ++,以访问mysql数据库.一开始我尝试过:

I want to setup connector/c++ on my raspberry Pi to access a mysql db. At first I tried:

sudo apt-get install libmysqlcppconn-dev

安装成功,但出现错误:

which installed successfully, but the I got the error:

ERR: MySQL_Connection::setReadOnly() (MySQL error code: 0, SQLState:  )

我在使用的cppconn版本随附的

,如下所示:

which comes with the version of cppconn I'm using, as its said here: MySQL Connector for C++ | MySQL_Connection::setReadOnly() exception on setSchema

当我检查时:

sudo apt-cache show libmysqlcppconn-dev

它说版本:1.1.0-4"

it said "version: 1.1.0-4"

因此,我然后尝试从源代码安装最新的软件包: https://dev.mysql.com/downloads/connector/cpp/处于->源代码->通用Linux(与体系结构无关),压缩的TAR存档

So then I tried to install the latest package from source: https://dev.mysql.com/downloads/connector/cpp/ which was under ->Source Code -> Generic Linux (Architecture Independent), Compressed TAR Archive

我下载了它并执行了"tar xvzf mysql -....",一切正常.但是当我尝试用

I downloaded it and did "tar xvzf mysql-...." and everything worked. But when I tried to build it with

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,但我也不知道如何告诉它文件的位置或文件的实际位置.

I know it means, it cant find the mysql_config, but neither do I know how to tell it where the file is, nor where the file actually is.

所以请帮助我.我对此感到厌烦.

So please help me. I'm so sick of this.

非常感谢.

我尝试手动安装最新的软件包,这些软件包是从以下位置下载的:

I tried to install the latest packages manually, which I downloaded from:

https://packages.debian.org/jessie/armhf/libmysqlcppconn -dev/下载

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

这是好事还是坏事?

推荐答案

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

You need to install the MySQL client library development files:

apt-get install libmysqlclient-dev

一种更简单的方法来确保已安装所有依赖项,是要求易于为其打包版本安装所有构建依赖项:

An easier way to try and ensure you have all dependencies installed, is to ask apt to install all build dependencies for it's packaged version:

apt-get build-dep libmysqlcppconn-dev

这篇关于在raspberryPi上安装mysql连接器c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆