Watch this Author's files
I setup Matlab to use the Microsoft Visual C++ 2008 Express compiler >> mex -setup
Then I compiled the file >> mex -DWIN32 -I'C:\Program Files\MySQL\MySQL Server 5.0\include' -L'C:\Program Files\MySQL\MySQL Server 5.0\lib\opt' -llibmysql mysql.cpp
Works great!!!
Contact us at files@mathworks.com