第三章 和c++串联起来

  • 命令: g++ mysql.cc -L usr/lib/mysql -lmysqlclient
#include
#include
using namespace std;
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
int main()
{
    const char *server = "localhost";
    const char *user= "root";
    const char *password = "alex";
    const char *database = "test03";
    conn = mysql_init(NULL);
    if(!mysql_real_connect(conn,server,user,password,database,0,NULL,0))
    {
        cout<<"connect error"<

你可能感兴趣的:(第三章 和c++串联起来)