Using MySQL from a Rust Agent
SkillDatabases & dataUsing golem:rdbms/mysql from a Rust Golem agent. Use when the user asks to connect to MySQL, run SQL, execute a MySQL transaction, or use MySQL from Rust agent code.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Using MySQL from a Rust Agent skill
What this skill tells your AI
The instructions your AI receives, as published by golemcloud/golem in golem-skills/skills/rust/golem-add-mysql-rust/SKILL.md and read by ahel’s review.
golem-rust already exposes the host bindings for golem:rdbms/mysql@1.5.0, so you do not need an extra crate.
Imports
use golem_rust::bindings::golem::rdbms::mysql::{
DbConnection,
DbValue,
};
Open a Connection
let conn = DbConnection::open("mysql://user:password@localhost:3306/app")
.map_err(|err| format!("{err:?}"))?;
If the user asks for a method that returns a plain String, keep the public method signature as
String and handle host errors inside the method with expect(...) or panic!(...) rather than
changing the signature to Result<String, _>.
Query Data
MySQL placeholders use ?.
let result = conn
.query(
"SELECT ?",
vec![DbValue::Varchar("hello".to_string())],
)
.map_err(|err| format!("{err:?}"))?;
let row = result.rows.first().ok_or("query returned no rows")?;
let value = row.values.first().ok_or("query returned no columns")?;
let message = match value {
DbValue::Varchar(value)
| DbValue::Text(value)
| DbValue::Tinytext(value)
| DbValue::Mediumtext(value)
| DbValue::Longtext(value)
| DbValue::Fixchar(value) => value.clone(),
other => return Err(format!("unexpected MySQL value: {other:?}")),
};
Execute Statements
let affected = conn
.execute(
"INSERT INTO notes (id, body) VALUES (?, ?)",
vec![DbValue::Int(1), DbValue::Varchar("hello".to_string())],
)
.map_err(|err| format!("{err:?}"))?;
Transactions
let tx = conn.begin_transaction().map_err(|err| format!("{err:?}"))?;
tx.execute(
"UPDATE notes SET body = ? WHERE id = ?",
vec![DbValue::Varchar("updated".to_string()), DbValue::Int(1)],
)
.map_err(|err| format!("{err:?}"))?;
tx.commit().map_err(|err| format!("{err:?}"))?;
Signals
- GitHub stars
- 2k
- Forks
- 212
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
golem-add-mysql-rust- Source
- github.com/golemcloud/golem