MySQL 8.4.0 version kicked me below the waist line

Fix for the unknown variable 'default-auth=mysql_native_password'


2 min read


If you're coming from google because you saw unknown variable 'default-auth=mysql_native_password'. - all you need to do is to change --default-authentication-plugin=mysql_native_password to --mysql-native-password=ON.


I recently did a deployment where a docker compose project had own mysql that was only pinned to the version mysql:8. The config snippet below.

    image: mysql:8
    restart: always
    command: --default-authentication-plugin=mysql_native_password
        - db_data:/var/lib/mysql
        - db_socket:/var/run/mysqld
        - MYSQL_DATABASE=xxxxx
        - MYSQL_ROOT_PASSWORD=xxxxx
        test: ['CMD', 'mysqladmin', 'status', '-hlocalhost', '-uroot', '-pxxxxxx']
        interval: 1m
        timeout: 5s
        retries: 3
        start_period: 1m

Immediately one could point out that it's a huge mistake to only pin by a major version. For a truly production project, I would almost never host my own database - aka, I would always use a managed one.

Anyhow, this one slipped through and caused completely unnecessary downtime.


After looking through the looks I could see mysql 8.4.0 Plugin 'mysql_native_password' is not loaded and unknown variable 'default-auth=mysql_native_password' lines and that the server is shutting down.

Almighty Google!

That means I started surfing. Since it was released just two days ago (on April 30th), there weren't any immediately results that seemed relevant as deemed by my brains.

Based on that, I searched for change log/release log. I land on this page and do Cmd + F (search in page) to see if there has been anything regarding the plugin.

Boom, lucky result under "Deprecation and Removal Notes" section

Important Change: The deprecated mysql_native_password authentication plugin is now disabled by default. It can be enabled by starting MySQL with the new --mysql-native-password=ON server option, or by adding mysql_native_password=ON to the [mysqld] section of your MySQL configuration file.

That led me to update the compose config and fix the downtime.

    image: mysql:8.4
    restart: always
    command: --mysql-native-password=ON
        - db_data:/var/lib/mysql
        - db_socket:/var/run/mysqld

That's it. I hope by writing this I won't land on this mistake again. Restoring from backup is such as boring thing to do.

Or maybe it's a sign to stop procrastinating migration to pg... would be lovely to leverage Cloudflare's hypertunnel...

Did you find this article valuable?

Support Lukas by becoming a sponsor. Any amount is appreciated!