It has been an end to my C++ class last Sunday, which I've enjoyed the 5 weeks training. Thanks to my trainor who is not so selfish in sharing his knowledge to his students. Kudos to Ernest Bercilla, a full time applications trainor of ITTC.
Mostly all of the languages I've learned it was just self taught, actually this was my first time acquiring a knowledge in a programming language on a training. Well as day one in my class, my objective was to write C++ code to connect to the MYSQL API, which I did now because of the foundation that I've learned during the training.
Here's the steps, how I've used MySQL API, my C++ Ide is codeblocks
1. download a library from http://devpaks.org/ , find the ones for mysql under database.
2. extract the package, am using 7-zip, so DevPak files is supported.
3. create a mysql folder under the C:\Program Files\CodeBlocks\MinGW\include
4. copy the include from the content of libmysql to the folder that has been created.
5. set the library and point it to the location of libmysql.a

6. To test create a database and a table name.
Here's my sample code:
/* Language : C++ */
#include <windows.h>
#include <iostream>
#include <mysql/mysql.h>
using namespace std;
int main() {
//connection params
char *host = "localhost";
char *user = "root";
char *pass = "";
char *db = "cardsauce";
//sock
MYSQL *conn; //pointer
MYSQL_RES *res;//pointer
MYSQL_ROW row;
conn = mysql_init(0);
if (!conn){
cout << "sock handle failed!" << mysql_error(conn) << endl;
}
//connection
if (!mysql_real_connect(conn, host, user, pass, db, 0, NULL, 0)){
cout << "connection fail: " << mysql_error(conn) << endl;
}
mysql_query(conn,"SELECT * FROM users");
res = mysql_use_result(conn);
while (row = mysql_fetch_row(res)) {
cout << row[0] << " " << row[1] << endl;
}
//closing connection
mysql_close(conn);
return EXIT_SUCCESS;
}