MySQL

MySQL is a widely used open-source relational database system. The MySQL block connects your workflow directly to a MySQL database, letting you read and write data without leaving Sim. It handles the connection details—host, port, database, credentials, and SSL mode—so blocks can query, insert, update, delete, and execute raw SQL against your database.

With the MySQL block, you can:

  • Query data: Run SELECT statements and get back rows with a row count
  • Insert, update, and delete records: Write key-value data to a table or modify existing rows with a WHERE clause
  • Execute raw SQL: Run arbitrary SQL statements, such as DDL for creating tables
  • Introspect the schema: Retrieve table structures, columns, keys, indexes, and the list of available databases on the server

In Sim, the MySQL block allows your agents to read from and write to a MySQL database as part of a workflow—querying records to feed downstream logic, inserting or updating rows based on agent output, cleaning up data with deletes, running custom SQL for one-off operations, and introspecting the schema to understand table structure before generating queries.

Usage Instructions

Integrate MySQL into the workflow. Can query, insert, update, delete, and execute raw SQL.

Actions

mysql_query

Execute SELECT query on MySQL database

Input

ParameterTypeRequiredDescription
hoststringYesMySQL server hostname or IP address
portnumberYesMySQL server port (default: 3306)
databasestringYesDatabase name to connect to (e.g., my_database)
usernamestringYesDatabase username
passwordstringYesDatabase password
sslstringNoSSL connection mode (disabled, required, preferred)
querystringYesSQL SELECT query to execute (e.g., SELECT * FROM users WHERE active = 1)

Output

ParameterTypeDescription
messagestringOperation status message
rowsarrayArray of rows returned from the query
rowCountnumberNumber of rows returned

mysql_insert

Insert new record into MySQL database

Input

ParameterTypeRequiredDescription
hoststringYesMySQL server hostname or IP address
portnumberYesMySQL server port (default: 3306)
databasestringYesDatabase name to connect to (e.g., my_database)
usernamestringYesDatabase username
passwordstringYesDatabase password
sslstringNoSSL connection mode (disabled, required, preferred)
tablestringYesTable name to insert into (e.g., users, orders)
dataobjectYesData to insert as key-value pairs

Output

ParameterTypeDescription
messagestringOperation status message
rowsarrayArray of inserted rows
rowCountnumberNumber of rows inserted

mysql_update

Update existing records in MySQL database

Input

ParameterTypeRequiredDescription
hoststringYesMySQL server hostname or IP address
portnumberYesMySQL server port (default: 3306)
databasestringYesDatabase name to connect to (e.g., my_database)
usernamestringYesDatabase username
passwordstringYesDatabase password
sslstringNoSSL connection mode (disabled, required, preferred)
tablestringYesTable name to update (e.g., users, orders)
dataobjectYesData to update as key-value pairs
wherestringYesWHERE clause condition (without WHERE keyword)

Output

ParameterTypeDescription
messagestringOperation status message
rowsarrayArray of updated rows
rowCountnumberNumber of rows updated

mysql_delete

Delete records from MySQL database

Input

ParameterTypeRequiredDescription
hoststringYesMySQL server hostname or IP address
portnumberYesMySQL server port (default: 3306)
databasestringYesDatabase name to connect to (e.g., my_database)
usernamestringYesDatabase username
passwordstringYesDatabase password
sslstringNoSSL connection mode (disabled, required, preferred)
tablestringYesTable name to delete from (e.g., users, orders)
wherestringYesWHERE clause condition (without WHERE keyword)

Output

ParameterTypeDescription
messagestringOperation status message
rowsarrayArray of deleted rows
rowCountnumberNumber of rows deleted

mysql_execute

Execute raw SQL query on MySQL database

Input

ParameterTypeRequiredDescription
hoststringYesMySQL server hostname or IP address
portnumberYesMySQL server port (default: 3306)
databasestringYesDatabase name to connect to (e.g., my_database)
usernamestringYesDatabase username
passwordstringYesDatabase password
sslstringNoSSL connection mode (disabled, required, preferred)
querystringYesRaw SQL query to execute (e.g., CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(255)))

Output

ParameterTypeDescription
messagestringOperation status message
rowsarrayArray of rows returned from the query
rowCountnumberNumber of rows affected

mysql_introspect

Introspect MySQL database schema to retrieve table structures, columns, and relationships

Input

ParameterTypeRequiredDescription
hoststringYesMySQL server hostname or IP address
portnumberYesMySQL server port (default: 3306)
databasestringYesDatabase name to connect to (e.g., my_database)
usernamestringYesDatabase username
passwordstringYesDatabase password
sslstringNoSSL connection mode (disabled, required, preferred)

Output

ParameterTypeDescription
messagestringOperation status message
tablesarrayArray of table schemas with columns, keys, and indexes
databasesarrayList of available databases on the server

On this page