Automattic / vip-cli

The VIP-CLI
https://docs.wpvip.com/vip-cli/
MIT License
59 stars 17 forks source link

Latest MySQL image deprecated --default-authentication-plugin, database won't start on latest image #1816

Closed cvharris closed 5 months ago

cvharris commented 7 months ago

According to this the latest image of MySQL deprecates the --default-authentication-plugin but not in a nice way. If you try to run vip dev-env create it uses this latest image and the database container never spins up.

This is fixed by following the solution they indicate and replacing the flag with --mysql-native-password=ON

sjinks commented 7 months ago

This was fixed in VIP CLI 2.39.4. Please update your VIP CLI and let us know if the issue persists. Thank you!

cvharris commented 7 months ago

That was it, thank you!

OulipianSummer commented 6 months ago

Dropping in here to say that even after the update to a newer version of VIP CLI I am still observing the issue described here.

I completely uninstalled my old VIP CLI, removed the scaffolding files in ~/.local/share/vip, and then reinstalled v2.39.6.

Even then, when running vip dev-env create the database container that the cli pulls down still has the problematic --default-authentication-plugin flag.

Here is the container config vip downloaded, located at ~/.local/share/vip/lando/compose/{my-dev-env}/database-0.yml

services:
  database:
    image: mysql:8
    command: >-
      docker-entrypoint.sh mysqld
      --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
      --max_allowed_packet=67M
      --default-authentication-plugin=mysql_native_password
    ports:
      - 127.0.0.1::3306
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      LANDO_NO_USER_PERMS: 1
      LANDO_NO_SCRIPTS: 1
      LANDO_NEEDS_EXEC: 1
    volumes:
      - database_data:/var/lib/mysql
networks: {}
volumes:
  database_data: null
version: '3.6'

When I attempt to start the dev-env, the database container crashes.

2024-05-09 14:35:25 lando 18:35:25.55 INFO  ==> Lando handing off to: docker-entrypoint.sh mysqld --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION --max_allowed_packet=67M --default-authentication-plugin=mysql_native_password
2024-05-09 14:35:25 lando 18:35:25.55 DEBUG ==> Running command with exec...
2024-05-09 14:35:26 2024-05-09T18:35:26.642961Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-05-09 14:35:26 2024-05-09T18:35:26.644342Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2024-05-09 14:35:26 2024-05-09T18:35:26.644438Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.0) initializing of server in progress as process 106
2024-05-09 14:35:26 2024-05-09T18:35:26.655641Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-05-09 14:35:27 2024-05-09T18:35:27.048383Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-05-09 14:35:28 2024-05-09T18:35:28.573447Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default-authentication-plugin=mysql_native_password'.
2024-05-09 14:35:28 2024-05-09T18:35:28.573732Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2024-05-09 14:35:28 2024-05-09T18:35:28.573744Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-05-09 14:35:30 2024-05-09T18:35:30.407598Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.
sjinks commented 6 months ago

This is not correct:

    image: mysql:8

should be

    image: mysql:8.4

What does

grep mysql "$(dirname "$(which vip)")/../lib/node_modules/@automattic/vip/assets/dev-env.lando.template.yml.ejs"

yield?

OulipianSummer commented 6 months ago
      command: docker-entrypoint.sh mysqld --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION --max_allowed_packet=67M
      image: mysql:8.4
      command: docker-entrypoint.sh mysqld --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION --max_allowed_packet=67M --mysql-native-password=ON
        - database_data:/var/lib/mysql
    description: "Connect to the DB using mysql client (e.g. allow to run imports)"
      - mysql -hdatabase -uwordpress -pwordpress -Dwordpress

Interesting... so why would Docker be building off of what appears to be an outdated container image when the new one is just chilling there in node_modules?