文档详情

windows 下C++操作Mysql的一些总结.doc

发布:2017-12-17约5.84千字共5页下载文档
文本预览下载声明
windows 下C++操作Mysql的一些总结 /////////////////////////////////////////////////////// windows 下C++连接Mysql: 首先完全安装Mysql(注意要选择完全安装,又不然将没有include和lib),并把Mysql的include目录和lib\opt引入 ,还有libmySQL.dll。 /pdw2009/archive/2008/03/09/184869.html 在用VC 连接Mysql 5.0 时出现如下错误 C:/MYSQL/INCLUDE/mysql_com.h(116) : error C2146: syntax error : missing ; before identifier fd C:/MYSQL/INCLUDE/mysql_com.h(116) : error C2501: SOCKET : missing storage-class or type specifiers C:/MYSQL/INCLUDE/mysql_com.h(116) : error C2501: fd : missing storage-class or type specifiers C:/MYSQL/INCLUDE/mysql_com.h(180) : error C2065: SOCKET : undeclared identifier C:/MYSQL/INCLUDE/mysql_com.h(180) : error C2146: syntax error : missing ) before identifier s C:/MYSQL/INCLUDE/mysql_com.h(181) : error C2059: syntax error : ) 参考下面文章 /u21/ac0ac04d-8071-456c-93fa-207ba1d37840.html 在StdAfx.h 中加入如下几行 #include winsock2.h #pragma comment(lib,ws2_32) mysql api用到socket的. 在头部加上这两句就好了 就可以。 /////////////////////////////////////////////////////////////////////////////////////// 解决Mysql链接错误:Client does not support authentication protocol requested by server; consider upgrading MySQL client 通过myodbc无法链接至MySQL的错误: Client does not support authentication protocol requested by server; consider upgrading MySQL client 官方的说法是 MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. ..... 如果你升级mysql到4.1以上版本后遇到以上问题,请先确定你的mysql client 是4.1或者更高版本.(WINDOWS下有问题你就直接跳到下面看解决方法了,因为MYSQL 在WINDOWS是client和server一起装上了的) 请使用以下两种方法之一 进入命令行下,转到MYSQL目录的BIN目录下,进入MYSQL命令行模式: 例:d:\mysql\binmysql -uroot -p123 (用户root,密码123) 其一: mysqlSET PASSWORD FOR root(用户名)@localhost(主机地址) = OLD_PASSWORD(你的密码); 其二: mysql UPDATE mysql.user SET Password = OLD_PASSWORD(newpwd) - WHERE Host = some_host AND User = some_user; mysql FLUSH PRIVILEGES; //////////////////////////////////////////////////////////////////////////// VC++连MySQL中要用到的MySQL函数: MYSQL* mysql_init
显示全部
相似文档