Skip to content

[DEV] Docker Up: Unknown variable 'default-authentication-plugin=mysql_native_password'. #5124

Closed
@jhm-ciberman

Description

@jhm-ciberman

Describe the Bug

When following the development instructions detailed in the development docs, the Mysql container fails to initialize:

Steps to Reproduce

git clone https://github.com/BookStackApp/BookStack
cd BookStack
cp .env.example .env
chgrp -R docker storage
docker-compose up -d

Then on docker desktop, the bookstack-db-1 fails to initialize:

2024-07-16 21:39:10 2024-07-17 00:39:10+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.1-1.el9 started.
2024-07-16 21:39:10 2024-07-17 00:39:10+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-07-16 21:39:10 2024-07-17 00:39:10+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.1-1.el9 started.
2024-07-16 21:39:11 '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2024-07-16 21:39:11 2024-07-17T00:39:11.133057Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-07-16 21:39:11 2024-07-17T00:39:11.389421Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.1) starting as process 1
2024-07-16 21:39:11 2024-07-17T00:39:11.402980Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-07-16 21:39:12 2024-07-17T00:39:12.187110Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-07-16 21:39:12 mysqld: Table 'mysql.plugin' doesn't exist
2024-07-16 21:39:12 2024-07-17T00:39:12.463906Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2024-07-16 21:39:12 2024-07-17T00:39:12.464124Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.464277Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.464436Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.464633Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.464776Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.464917Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.465024Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.557658Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2024-07-16 21:39:12 2024-07-17T00:39:12.683144Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2024-07-16 21:39:12 2024-07-17T00:39:12.698342Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-07-16 21:39:12 2024-07-17T00:39:12.698420Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-07-16 21:39:12 2024-07-17T00:39:12.710369Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2024-07-16 21:39:12 2024-07-17T00:39:12.711001Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2024-07-16 21:39:12 2024-07-17T00:39:12.711216Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
2024-07-16 21:39:12 2024-07-17T00:39:12.711240Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2024-07-16 21:39:12 2024-07-17T00:39:12.711366Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default-authentication-plugin=mysql_native_password'.
2024-07-16 21:39:12 2024-07-17T00:39:12.712005Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-07-16 21:39:14 2024-07-17T00:39:14.286948Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.1)  MySQL Community Server - GPL.
2024-07-16 21:39:14 2024-07-17T00:39:14.287026Z 0 [System] [MY-015016] [Server] MySQL Server - end.

It seems the problem is that the pulled image version is MySQL 8.4 and the flag --default-authentication-plugin=mysql_native_password does not exists in MySQL 8.4.

Expected Behaviour

The DB container should start.

Screenshots or Additional Context

Fix

if I change the docker-compose.yml and destroying and recreating the containers and volumes, the problem is solved. More info here.

services:
  db:
    image: mysql:8
    environment:
      MYSQL_DATABASE: bookstack-dev
      MYSQL_USER: bookstack-test
      MYSQL_PASSWORD: bookstack-test
      MYSQL_RANDOM_ROOT_PASSWORD: 'true'
-   command: --default-authentication-plugin=mysql_native_password
+   command: --mysql-native-password=ON
    volumes:
      - ./dev/docker/init.db:/docker-entrypoint-initdb.d
      - db:/var/lib/mysql

Aditionally, you probably may want to specify a more specific image version:

- image: mysql:8
+ image: mysql:8.4

Related question: Have you considered using Laravel Sail for local development instead of a custom docker image? It is a more standard way among laravel developers and it is easier to get started without so much hassle.


Edit: In the end, I did get up the DB to work, but the app itself does not load in the browser. Chrome shows "Connection was refused".

Browser Details

No response

Exact BookStack Version

development branch and release branch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions