ubuntu22.04 cmake 配置mysql

报错信息:

CMake Error at CMakeLists.txt:33 (find_package):

By not providing "FindMySQL.cmake" in CMAKE_MODULE_PATH this project has

asked CMake to find a package configuration file provided by "MySQL", but

CMake did not find one.

Could not find a package configuration file provided by "MySQL" with any of

the following names:

复制代码
MySQLConfig.cmake
mysql-config.cmake

Add the installation prefix of "MySQL" to CMAKE_PREFIX_PATH or set

"MySQL_DIR" to a directory containing one of the above files. If "MySQL"

provides a separate development package or SDK, be sure it has been

installed.

解决方法:

cmakelist中,添加类似的语句:
!!!!!其中/usr/include/mysql 和 test.app要适当更改!!!!!

cpp 复制代码
include_directories(/usr/include/mysql)
target_link_libraries(test.app mysqlclient)

其它问题:

如有其它问题,请先排查是否正确安装MySQL和API:

API 安装:

bash 复制代码
sudo apt-get update
sudo apt-get install libmysql++-dev
sudo apt-get install libmysqlclient-dev
相关推荐
RestCloud14 小时前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud15 小时前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence17 小时前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
Java水解18 小时前
Mysql查看执行计划、explain关键字详解(超详细)
后端·mysql
知其然亦知其所以然1 天前
MySQL 社招必考题:如何优化查询过程中的数据访问?
后端·mysql·面试
DemonAvenger1 天前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
程序新视界1 天前
如何在MySQL中创建聚集索引?
mysql
AAA修煤气灶刘哥1 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
程序新视界1 天前
学习MySQL绕不开的两个基础概念:聚集索引与非聚集索引
mysql
RestCloud2 天前
跨境数据传输:ETL如何处理时区与日期格式差异
mysql·api