MySQL connector for pmcp-server-toolkit.
Pure-Rust + Lambda-deployable: sqlx 0.8.6 with tls-rustls-aws-lc-rs (no
OpenSSL) per feedback_avoid_docker_pure_rust_lambda memory.
[MysqlConnector] implements the toolkit's 3-method
SqlConnector trait:
dialect,
execute (canonical
:name placeholders translated to ? via
translate_placeholders),
and schema_text
(driven by information_schema.columns filtered by the MySQL database name).
REVIEWS M3: [MysqlConnector::connect] uses
MySqlPool::connect_lazy to defer
TCP I/O to first use. connect_lazy parses the URL synchronously, so a
malformed URL returns [ConnectorError::Connection] immediately, while a
real connection failure surfaces on the first
execute / schema_text
call. The pub async fn signature is retained for API symmetry with
PostgresConnector::connect and to leave room for a future connect_eager
variant that DOES open the connection.
REVIEWS H5: the dev_mock feature exposes
pmcp_toolkit_mysql::dev_mock::MysqlMock for examples + downstream
integration tests. It is NOT enabled by default.
Security
[ConnectorError::Connection] error text NEVER contains the raw URL or its
password — the password segment is redacted via [sanitize_url] before the
error is constructed (T-84-06-02).
Example
# use pmcp_toolkit_mysql::MysqlConnector;
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
let conn = MysqlConnector::connect("mysql://localhost/mydb").await?;
# Ok(())
# }