QT使用 mysql时出现问题,求大神看下

我的系统:win7 64bit
QT版本:QT5.4 vs2013的编译器
MySQL5.6安装正常
我是初学者,想试验一下mysql的使用,用main函数调用以下代码时出现:
Starting C:\Qt\Qt5.4.1\QTprojects\build-Mysql_test-Desktop_Qt_5_4_1_MSVC2013_64bit-Debug\debug\Mysql_test.exe...
build error!haha
C:\Qt\Qt5.4.1\QTprojects\build-Mysql_test-Desktop_Qt_5_4_1_MSVC2013_64bit-Debug\debug\Mysql_test.exe exited with code 0

代码如下:
#ifndef CONNECTDATABASE_H
#define CONNECTDATABASE_H

#include
#include
#include
#include
#include
#include
bool connectiondatabase()
{
QSqlDatabase db(QSqlDatabase::addDatabase("QMYSQL"));
db.setHostName("localhost");
db.setDatabaseName("Student");
db.setUserName("root");
db.setPassword("123456");
if(db.open())
{
qDebug()<<"database is established!";
}
else
{
qDebug()<<"build error!haha";
return false;
}
QSqlQuery query;

query.exec(QObject::tr("create table student(sno varchar(10) not null primary key,sname "
                       "varchar(20) not null,scalss varchar(10) not null"));
query.exec(QObject::tr("insert into student(sno,sname,sclass) values('2009001','lilei',"
                       "'0901')"));
query.exec(QObject::tr("insert into student(sno,sname,sclass) values('2009002','lucy',"
                       "'0902')"));
query.exec(QObject::tr("insert into student(sno,sname,sclass) values('2009003','mike',"
                       "'0903')"));

query.exec("select * from student");
qDebug()<<"sno     sname      scalss";
while(query.next())
{
    qDebug()<<query.value(0).toString()<<"   "<<query.value(1).toString()<<"   "
           <<query.value(2).toString();
}
return true;

}

#endif // CONNECTDATABASE_H

db打开失败
1.目录环境中有mysql的驱动吗?
2.可以安装navicat for mysql 看看能连接成功不

图片说明
有驱动,应该是这个吧,我试试navicat for mysql ,谢谢!

qt 的pro 加了qt+=sql么

请问解决了吗?我刚好现在遇到跟你一模一样的问题