mysql的数据库的多线程安全访问

首先遍历mysqlclient.so的时候,需要指定./configure --enable_thread-safe-client

#include "/usr/include/mysql/mysql.h"

#include 

#include 
#include 
#include 
void testthread(void * arg)
{
    while(1)
    {
        //MYSQL * mysql_handler = mysql_init(NULL);
	mysql_thread_init();
	
        MYSQL * mysql_handler = mysql_init(NULL);
        if(!mysql_real_connect(mysql_handler,"127.0.0.1","root","ming123","test",3306,NULL,0))
        {
	    std::cout<<"err"<

你可能感兴趣的:(mysql)