Check if bitness of your program and libmysql.dll match - they both must be either 32bit or 64bit.
If you don't know bitness of libmysql.dll, try to compile and run your program first for target Win32, target CPU family i386 and then for target Win64, Target CPU family x86_64.