Skip to content

fix: support custom user creation on MySQL 8.4+#595

Open
Diegiwg wants to merge 1 commit into
geerlingguy:masterfrom
Diegiwg:feat/mysql-8.4-caching-sha2-password-support
Open

fix: support custom user creation on MySQL 8.4+#595
Diegiwg wants to merge 1 commit into
geerlingguy:masterfrom
Diegiwg:feat/mysql-8.4-caching-sha2-password-support

Conversation

@Diegiwg

@Diegiwg Diegiwg commented Mar 23, 2026

Copy link
Copy Markdown

Note

The work on this PR was sponsored by Devopness

Problem

Creating custom users via the mysql_users variable fails on MySQL 8.4+ with authentication errors.

Root Cause

MySQL 8.4+ disables mysql_native_password by default. The role's user creation logic still uses the traditional password-based approach, which no longer works.

Solution

  • Use caching_sha2_password plugin for MySQL 8.0+
  • Keep traditional password auth for MySQL < 8.0 and MariaDB
  • Fully backward compatible

Testing

  • MySQL 8.4 on Ubuntu 24.04
  • MySQL 8.0 on Ubuntu 24.04

References

MySQL 8.4+ disables mysql_native_password by default and it will be
removed in MySQL 9.0. This adds support for caching_sha2_password
authentication while maintaining backward compatibility.

See: https://dev.mysql.com/doc/refman/8.4/en/native-pluggable-authentication.html

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Diegiwg Diegiwg changed the title feat: add MySQL 8.4+ caching_sha2_password support fix: support custom user creation on MySQL 8.4+ Mar 25, 2026
@Diegiwg

Diegiwg commented Mar 25, 2026

Copy link
Copy Markdown
Author

@geerlingguy could you review this when you have a chance?

This fixes custom user creation (mysql_users variable) on MySQL 8.4+.

Thank you for the amazing work on this role (and other role's)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant