Weird behaviour of mysql-connector-c++ in OSX
I also got this problem. I guess the reason is the mismatch between macos and mysqlconn. The latest mysqlconn binary release only supports up to macos 10.10 and the latest macos is 10.11. I compiled the driver myself and the issue has gone. So you can try to compile that yourself and it should work. Here are the commands I used:

cmake -DMYSQL_CONFIG_EXECUTABLE=/usr/local/Cellar/mysql/5.7.15/bin/mysql_config -DCMAKE_INSTALL_PREFIX=~/
make;make install


Then you can just include ~/include and ~/lib for your header and libs. Hope this works for you. If this still does not work, try to check whether you used the same gcc for both mysqlconn and your program. brew now installs gcc 6.2 but mac only carries 4.2.