if(!mysql_real_connect(&mysql,"127.0.0.1","root","1234","mydb",3306,NULL,0))AfxMessageBox(mysql_error(&mysql));你这样看看返回的错误是什么,只有知道错误才能对症下药!