Requirements:
C++ MySQL Connector Library, which can be installed on Unix/Linux Systems with: apt-get install libmysqlcppconn-dev
Installation:
Use the specific branch for your Godot Version, master branch should be for Godot's master branch!
Simply place or clone the repository into /path/to/godot/modules folder
and rename it to "mysql" and build the engine from source.
Module directory should look like this "/path/to/godot/modules/mysql".
- instance module; MySQL.new()
- set login info; mysql.credentials("localhost", "username", "password")
- select database; mysql.select_database("pinguins")
- query or execute; mysql.query("sql_code","colum_name_or_index") / mysql.execute("sql_code")
var mysql = MySQL.new()
var rows = mysql.query("SELECT COUNT(*) FROM table_name", "1")
print(rows)
var mysql = MySQL.new()
var name = mysql.query("SELECT * FROM table_name WHERE id='1'", "name")
or
var name = mysql.query("SELECT name FROM table_name WHERE id='1'", "1")
print(name)
var mysql = MySQL.new()
mysql.execute("INSERT INTO table_name (id, name) VALUES (0, 'billy the pinguin')")