How do i add Mysql to bge?


Can anyone point me into the direction to get mysql into bge?
i read that i need mysql/connector and install it etc, but what i dont find is is that ready for distribution?

can i just install it into my .exe folder and use it on any system?

anyone done this before? and can help me in the right direction?
i dont need advice on how mysql itself works, just how to implement it into bge.

I’m sure your do that via pure Python binding. This has nothing to do with the BGE nor does the BGE support that (it is not necessary anyway).

I suggest you look how you can access your MySQL database via python (there should be tutorials in the net). When this works you can use that knowledge within BGE Python scripts.

I did not try to use mysql in bge, only in common scene -
I think the principals of its usage in bge are the same.

For local, there is SQLite, which has (most of) the capabilities of MySQL, just stored in a single file.

If you are doing this for something like storing user data online, it is a terrible idea to connect directly to a remote database from a client. You will probably have a password stored somewhere in your client, and published BGE games can be cracked to reveal the source code, or the outgoing packets can be sniffed to find the address, username and password of the server. This means that the user can alter the database however they want.

As a solution to this, you should look into RESTful APIs. This is where the server has a database, and some language, like PHP, receives requests, processes the request (check if it is valid, prevent SQL injection, etc.), then does something with the database and then sends a response back to the client.

ok indeed, it wont be that safe, and i also didnt look for an other solution.
i got it working now with the requests module, sending POST data to a php script on the server, processing the data into a mysql database.

thanks for the info.