1. MariaDB 공식 홈페이지 : 링크

2. C++ Programs to MariaDB : 링크

3. C++ 헤더 파일 다운 : 링크

4. CPP test 파일 git : 링크

 

 

mysql.h 없을시 다운 

sudo apt install libmysqlclient-dev -y

 

mysql.h 위치 찾는 명령어

mysql_config --cflags

 

#include  mysql.h 경로로 추가하는 방법

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

 

 

빌드 명령어 방법

gcc mariadb_code.c -o mariadb_program 'mariadb_config --cflags --libs'

 

테스트 코드

#include <stdio.h>
#include <mysql.h>

void main()
{
  printf("MySQL client version: %s\n", mysql_get_client_info());
  return;
}

 

예제

https://zetcode.com/db/mysqlc/

 

MySQL C API programming

MySQL C API programming last modified September 23, 2020 This is a C programming tutorial for the MySQL database. It covers the basics of MySQL programming with the C API. You may also consider to look at the MySQL tutorial on ZetCode. About MySQL database

zetcode.com