MySQL has a C++ wrapper called MySQL++.
See
MySQL++ Documentation
It would be tedious to explain you all the steps involved.
For all API's, see
MySQL AB :: MySQL 5.0 Reference Manual :: 23 APIs and Libraries
The latter site is my primary site when it comes to mysql, along with a million other users/administrators/programmers
