Whatever you are trying to do here, THIS is the wrong way.

Please, everyone, don't use this, and don't write your own wrappers over libmysql! MySQL is released under the GPL license, NOT LGPL, even just linking against the librarie requires you to publish your source code under the GPL as well, otherwise you are violating an ACTUAL license. The GPL is no Kindergarten, no "oh, some neckbeards jerk over it" thingy and a lot of people and companies have been sued over GPL violations.
I can't stress this enough, if you want to stay out of legal trouble, DON'T use this. Ever.

The second thing is, you are opening your game and server up to a tremendous security risk, and this is no Kindergarten either! Embedding your username and password for your MySQL database into your game is a HORRIBLE idea, everyone, and this includes my mom, can get them out of your game and run arbitrary queries against YOUR database. If you prefer your server to not become an anonymous FTP full of childporn and warez, DON'T fucking use this.

Now, to make it easy, here is what you should do in the style of a "choose your own adventure"

1) I'm a programmer and I would like to save my highscores locally (read answer A)
2) I'm an idiot and I believe that a database should drive my MMORPG (read answer B)
3) I'm a sane person and would like to use a database to store some information about my users (read answer C)

Answer A: Use sqlite3. It's the de facto industry standard for these kinds of things, extremely optimized, fast and well tested.

Answer B: MySQL scales exceptionally bad, you might be better of with an alternative. That doesn't mean that MySQL is bad, or doesn't has its advantages for large scale applications, but you will likely end up putting a lot of effort into your caching strategy to get the load off of your database servers (not saying that you won't put a lot of work into your caches anyways). Please read about alternatives and then pick something that gets the job done best for your MMORPG, and keep in mind to always allocate enough resources for the worst case (and be prepared to scale over night).

Answer C: Use MySQL on your server and provide a RESTful API, or similar, for your game. Use normal HTTPS requests to communicate with the API and let the server handle the MySQL stuff. For the love of god, sanitize your user input and use data bindings.

I get it, most of you aren't serious and just want to play around, but if you have in mind to do something serious, or even remotely serious, please, please, please, don't make the wrong mistakes.

Last edited by JustSid; 04/15/13 20:13. Reason: Off of, I suck at english. Debate me.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com