# MySQL 8.4.0 version kicked me below the waist line

## TL DR

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`.

## Story

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.

```yaml
mysql:
    image: mysql:8
    restart: always
    command: --default-authentication-plugin=mysql_native_password
    volumes:
        - db_data:/var/lib/mysql
        - db_socket:/var/run/mysqld
    environment:
        - MYSQL_DATABASE=xxxxx
        - MYSQL_ROOT_PASSWORD=xxxxx
    healthcheck:
        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.

## Debugging

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 [https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-0.html](https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-0.html) 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`](https://dev.mysql.com/doc/refman/8.4/en/server-options.html#option_mysqld_mysql-native-password) [server option, or by addi](https://dev.mysql.com/doc/refman/8.4/en/server-options.html#option_mysqld_mysql-native-password)ng `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.

```yaml
mysql:
    image: mysql:8.4
    restart: always
    command: --mysql-native-password=ON
    volumes:
        - db_data:/var/lib/mysql
        - db_socket:/var/run/mysqld
    environment:
    #....
```

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...
