I’ve trying to use MySQL Connector C++ for my project, here the example code (retrieved from official site):

mysqlconn.cpp:

To identify which argument for linker is quite easy:

However, when I try to compile it, error happened (missing boost library)

Quick fix:

Now run the sample code:

% g++ mysqlconn.cpp -lmysqlcppconn; ./a.out
... MySQL replies: Hello World!
... MySQL says it again: Hello World!