VC连接MYSQL的问题,在线等,解决问题马上揭贴!
已加上libmysql.lib
include files也加了
library files也加了
MYSQL服务器也已经启动
MYSQL *m_pMySql= mysql_init(NULL);
if(!mysql_real_connect(m_pMySql,"localhost","mysql","123456","faxdb",0,NULL,0))
{
AfxMessageBox(mysql_error(&mysql),"错误",MB_OK);
//每次都运行到这,提示Access denied for user 'root'@'localhost'(using password:YES)
//把localhost换为IP地址的话提示host 'XXXX'is not allowed to connect to this MySQL server
return false;
}
看了很多这方面的例子,实在找不出哪个地方出错!