Have a look at http://www.codeproject.com/KB/cpp/sdba.aspx
I have an MFC dialog based application but its many years since I wrote the connection part - and I was told that such was the "mixed grill" used by me that it was a miricle that I got a connection.
This was the all important code:
m_dbHost = _T("localhost");
m_dbUser = _T("MySampleDB");
m_dbPassword = _T("MyPassword0;);
m_dbName = _T("vendatic");
conn = mysql_init(NULL);
mysql_real_connect (conn,m_dbHost, m_dbUser, m_dbPassword, m_dbName, 0, NULL, 0 );
I should be able to dig out a little more detail if needed.
Have a look at .NET - If you are just starting out then its the way to go. I reached a point in what I was doing that it was quicker to start over in .NET that continue with MFC. Assemblies are just so much easier than COM objects.