我正在连接 C 和 MySQL,并创建一个数据库。
我的代码如下:
我的代码如下:
#include <mysql.h>
#include <my_global.h>
int main(int argc, char **argv)
{MYSQL *conn;
conn = mysql_init(NULL);
if (conn == NULL) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);}
if (mysql_real_connect(conn, "localhost", "zetcode", "passwd", NULL, 0, NULL, 0) == NULL)
{printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);}
if (mysql_query(conn, "create database testdb")) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
mysql_close(conn);}
但是我没有mysql.h和my_global.h头文件
我该如何获取它们?
谢谢