VS开发环境
下载对应的安装包,然后拷贝include目录和静态库(也可以动态使用)
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.16-winx64.zip
centos C++ 开发环境,安装如下依赖
rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.16-2.el7.x86_64.rpm
在VS属性中要添加当前目录的引用 . 注意不是 ./
1.字符集设置
数据库uft8, VS2015 unicode,要先设置字符集
strcpy_s(sql, "set names utf8");
int ret = mysql_query(connect, sql);
if (ret)
{
//showError(mysql_error(connect));
return mysql_errno(connect);
}