Trouble connecting to MySQL server:

โš“ Rust    ๐Ÿ“… 2025-08-29    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 3      

surdeus

Ref: Unknown authentication protocol: `sha256_password` ยท Issue #396 ยท blackbeam/rust-mysql-simple ยท GitHub

I'm trying to connect to a MySQL server on Dreamhost shared hosting. Error message is:

Server side error message:

DriverError { Unknown authentication protocol: `sha256_password` }

This seems to indicate that the mysql crate is sending a different kind of authentication than the server expects. Here's the login setup:

let opts = mysql::OptsBuilder::new()
    .enable_cleartext_plugin(true)
    .secure_auth(false)
    .ip_or_hostname(creds.get("DB_HOST"))
    .tcp_port(portnum)
    .user(creds.get("DB_USER"))   
    .pass(creds.get("DB_PASS"))  
    .db_name(creds.get("DB_NAME"));

I've tried this with and without disabling secure_auth.
I tried what the documentation says is the correct OpsBuilder functions for that, but it doesn't help.

MySQL version: 8.0.28-0ubuntu0.20.04.3

Note that this is shared hosting. I can't look at mysql.user to see auth modes.

It's been reported as a mysql crate issue previously by someone else. But there's no reply on Github.

3 posts - 2 participants

Read full topic

๐Ÿท๏ธ Rust_feed