Help us help you
Is your feature request related to a problem? Please describe.
The MySQL-DBI extension is currently compiled against MySQL 5.x client library, which only supports the mysql_native_password authentication plugin.
MySQL 8.0.4+ changed the default authentication plugin to caching_sha2_password. When a MySQL 8.0 server uses this default authentication, the MySQL-DBI extension fails to connect with:
Error: [1045]: proxy authentication failed: invalid password
This does not affect all MySQL 8.0 servers — if the server or database user is configured to use mysql_native_password (e.g., IDENTIFIED WITH mysql_native_password BY '...'), the current extension works fine. However, some users ( those who rent a shared database server, me) have no way to change the authentication method and are unable to connect.
Additionally, MySQL 5.x reached End of Life in 2023, and compiling against a modern client library is a natural step forward.
(mine is 8.0.40)
Describe the solution you'd like
I have prepared a patch that migrates the MySQL-DBI extension from MySQL 5.x client library to MySQL 8.0 Connector/C. The changes include:
- Remove incompatible headers (
my_global.h, my_sys.h) that were deleted in MySQL 8.0
- Replace deprecated
my_bool type with bool (removed in MySQL 8.0)
- Guard
MYSQL_OPT_RECONNECT with a version check (MYSQL_VERSION_ID < 80100) since it was deprecated in 8.0 and removed in 8.1
- Update
AMBuilder to detect and link against MySQL 8.0 library (libmysql.lib / libmysqlclient.so)
- Update
configure.py to accept MySQL 8.0 Connector/C paths
- Update
AMBuildScript to detect MYSQL80 / MYSQL80_64 environment variables
The patch is backwards compatible — the same code still compiles against MySQL 5.x headers without issues, and MySQL 8.0 client library supports connecting to both MySQL 5.x and 8.0 servers.
Describe alternatives you've considered
- Using
mysql-native-password authentication on MySQL 8.0+ servers (requires server-side changes and is less secure)
- Downgrading to MySQL 5.7 (not feasible for many users who don't control their database server)
- Using a wrapper driver (would introduce additional complexity and maintenance burden)
Additional context
The patch has been tested and confirmed working:
- Compiled on Ubuntu 22.04 with
libmysqlclient-dev (MySQL 8.0 Connector/C)
- Links against
libmysqlclient.so.21
- Successfully connects to a remote MySQL 8.0.40 server from a SourceMod 1.12.0.7246 server
- The resulting
.so is 87KB (dynamic linking) vs the original 4MB (static linking), but this can be made static if desired
The branch is available at: https://github.com/HotoCocoaco/sourcemod/tree/dbi-mysql-8.0.40
I would wait for some feedback before making a pr.
Help us help you
Is your feature request related to a problem? Please describe.
The MySQL-DBI extension is currently compiled against MySQL 5.x client library, which only supports the
mysql_native_passwordauthentication plugin.MySQL 8.0.4+ changed the default authentication plugin to
caching_sha2_password. When a MySQL 8.0 server uses this default authentication, the MySQL-DBI extension fails to connect with:Error: [1045]: proxy authentication failed: invalid passwordThis does not affect all MySQL 8.0 servers — if the server or database user is configured to use
mysql_native_password(e.g.,IDENTIFIED WITH mysql_native_password BY '...'), the current extension works fine. However, some users ( those who rent a shared database server, me) have no way to change the authentication method and are unable to connect.Additionally, MySQL 5.x reached End of Life in 2023, and compiling against a modern client library is a natural step forward.
(mine is 8.0.40)
MySQL Server Team Blog: MySQL 8.0.4 : New Default Authentication Plugin : caching_sha2_password – Official announcement of the change.
MySQL 8.0 Reference Manual: Caching SHA-2 Pluggable Authentication – Clearly states that
caching_sha2_passwordis the default authentication plugin in MySQL 8.0.MySQL 8.0 Reference Manual: FAQ on Security – Also confirms the default plugin change.
MySQL Installer Guide – Mentions that the authentication method selection is available for MySQL 8.0.4 and later.
MySQL Secure Deployment Guide – Notes that
caching_sha2_passwordis the default authentication plugin.Describe the solution you'd like
I have prepared a patch that migrates the MySQL-DBI extension from MySQL 5.x client library to MySQL 8.0 Connector/C. The changes include:
my_global.h,my_sys.h) that were deleted in MySQL 8.0my_booltype withbool(removed in MySQL 8.0)MYSQL_OPT_RECONNECTwith a version check (MYSQL_VERSION_ID < 80100) since it was deprecated in 8.0 and removed in 8.1AMBuilderto detect and link against MySQL 8.0 library (libmysql.lib/libmysqlclient.so)configure.pyto accept MySQL 8.0 Connector/C pathsAMBuildScriptto detectMYSQL80/MYSQL80_64environment variablesThe patch is backwards compatible — the same code still compiles against MySQL 5.x headers without issues, and MySQL 8.0 client library supports connecting to both MySQL 5.x and 8.0 servers.
Describe alternatives you've considered
mysql-native-passwordauthentication on MySQL 8.0+ servers (requires server-side changes and is less secure)Additional context
The patch has been tested and confirmed working:
libmysqlclient-dev(MySQL 8.0 Connector/C)libmysqlclient.so.21.sois 87KB (dynamic linking) vs the original 4MB (static linking), but this can be made static if desiredThe branch is available at: https://github.com/HotoCocoaco/sourcemod/tree/dbi-mysql-8.0.40
I would wait for some feedback before making a pr.