blackbeam / mysql_async

Asyncronous Rust Mysql driver based on Tokio.
Apache License 2.0
372 stars 113 forks source link

sql_mode=ANSI_QUOTES causes `UnknownStatusFlags(32770)` error when trying to connect to MariaDB 11.2 #274

Closed wilsonzlin closed 4 months ago

wilsonzlin commented 6 months ago

I've been experiencing this error when I try to connect to MariaDB with a pool:

Io(Io(Custom { kind: InvalidData, error: UnknownStatusFlags(32770) }))

I think I have narrowed it down to the sql_mode option, and only when it has ANSI_QUOTES set.

To reproduce:

pushd "$(mktemp -d)"
cat <<'EOD' >mariadb.cnf
[mariadb]
sql_mode=ANSI_QUOTES
EOD

docker run --name repro --rm -d \
  -e MARIADB_ROOT_PASSWORD=test \
  -e MARIADB_DATABASE=test \
  -e MARIADB_USER=test \
  -e MARIADB_PASSWORD=test \
  -v ./mariadb.cnf:/etc/mysql/conf.d/repro.cnf \
  -p 3306:3306 \
  mariadb:11.2

cargo init --bin --name a .
cargo add tokio --features full
cargo add mysql_async
cat <<'EOD' >src/main.rs
#[tokio::main]
async fn main() {
  let pool = mysql_async::Pool::new("mysql://test:test@127.0.0.1:3306/test");
  let mut conn = pool.get_conn().await.unwrap();
}
EOD
cargo run

docker rm -fv repro

I'm not sure if this also applies to MySQL. Once ANSI_QUOTES is removed, everything works great, including other sql_mode options, mutual TLS, etc.

blackbeam commented 6 months ago

Thanks for report. I'll add the flag