DocsDataBasesMySQL / MariaDB

MySQL / MariaDB

Blueprint setup for MySQL and MariaDB runtime queries in Unreal Engine

Before You Start

  • Keep your MySQL or MariaDB server reachable from the machine running the game or editor.
  • Know the host, schema/database name, username, password, and port. The default MySQL port is 3306.
  • Create a database user with only the permissions your Blueprint flow needs.

Blueprint Connection Steps

  1. Open the Blueprint that should own the database connection.
  2. Add the MySQL connection component from this product, or place the MySQL connection actor in the level and reference it.
  3. On your setup event, add MakeMySQLConnectionParams.
  4. Fill Server, Database, Username, Password, and Port.
  5. Pass the params into CreateConnection.
  6. Bind OnConnectionStatusChanged, OnConnectionInvalid, OnQuerySelectStatusChanged, and OnQueryUpdateStatusChanged.

Run a Select Query

  1. Wait until OnConnectionStatusChanged reports a valid connection.
  2. Call SelectDataFromQuery with your SQL select statement.
SELECT id, display_name, coins
FROM players
ORDER BY coins DESC
LIMIT 10;
  1. Use the select status event to check for success or error text.
  2. Read values from the Blueprint data rows or table result.

Run an Insert, Update, or Delete

  1. Call UpdateDataFromQuery for statements that change data.
  2. Bind the update status event and show a success or failure message in your UI.
UPDATE players
SET coins = coins + 100
WHERE id = 42;

Using the Dedicated MySQL Actor

  1. Place the MySQL connection actor if you need several live connections at once.
  2. Call CreateNewConnection and store the returned ConnectionID.
  3. Pass that ConnectionID into future select or update nodes.
  4. Use QueryID when you need to match a completed event back to the UI request that started it.
  5. Create a MySQLConnectionOptions asset when you need SSL, timeout, connect attribute, read-only, or multi-result settings editable outside the Blueprint graph.

MySQL Notes

  • Use MySQL or MariaDB SQL syntax for queries.
  • Close connections when the owning Blueprint is finished with them.
  • Image and BLOB Blueprint nodes are not currently supported for MySQL or MariaDB in this package. Use Microsoft SQL Server if you need the image workflow today.
DataBases - MySQL / MariaDB | Athian Games