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

Closed
opened 2026-02-05 09:23:18 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @jhm-ciberman on GitHub (Jul 17, 2024).

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

Originally created by @jhm-ciberman on GitHub (Jul 17, 2024). ### Describe the Bug When following the development instructions detailed in [the development docs](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/development.md#development-using-docker), the Mysql container fails to initialize: ### Steps to Reproduce ```bash 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: ```log 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](https://stackoverflow.com/questions/78445419/unknown-variable-default-authentication-plugin-mysql-native-password). ```diff 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: ```diff - image: mysql:8 + image: mysql:8.4 ``` _______________ **Related question:** Have you considered using [Laravel Sail](https://laravel.com/docs/11.x/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
OVERLORD added the 🔧 Maintenance🐛 Bug labels 2026-02-05 09:23:18 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jul 17, 2024):

Thanks @jhm-ciberman for reporting with the added detail.
I found that removing the mysql command argument works fine now.
I've changed this via e145f21512, along with your advisory to set more specific versions.

Have you considered using Laravel Sail for local development instead of a custom docker image?

Really it's just a preference to stick the fundamental images/containers rather than add more abstraction layers.
Personally my ideal would be to have a single Ubuntu container (since that's our main common target) with all services & tools accessible in that one environment, but I haven't found the time to specifically delve into that.

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

Might be due to system permissions, you could try resetting permissions of storage, bootstrap/cache and public/uploads to open/777, at least temporarily, to confirm that.

I'll close this off since the title issue has been addressed but feel free to still comment if you need further help with the above in getting it running.

@ssddanbrown commented on GitHub (Jul 17, 2024): Thanks @jhm-ciberman for reporting with the added detail. I found that removing the mysql command argument works fine now. I've changed this via e145f21512fefc80dc779a705e6b23c42e33090e, along with your advisory to set more specific versions. > Have you considered using [Laravel Sail](https://laravel.com/docs/11.x/sail) for local development instead of a custom docker image? Really it's just a preference to stick the fundamental images/containers rather than add more abstraction layers. Personally my ideal would be to have a single Ubuntu container (since that's our main common target) with all services & tools accessible in that one environment, but I haven't found the time to specifically delve into that. > 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". Might be due to system permissions, you could try resetting permissions of `storage`, `bootstrap/cache` and `public/uploads` to open/777, at least temporarily, to confirm that. I'll close this off since the title issue has been addressed but feel free to still comment if you need further help with the above in getting it running.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4876