Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jhm-ciberman opened this issue Jul 17, 2024 · 1 comment

Comments

@jhm-ciberman
Copy link

jhm-ciberman commented 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

ssddanbrown added a commit that referenced this issue Jul 17, 2024
Quick local test performed, ran a working instance.
For #5124
@ssddanbrown ssddanbrown added this to the BookStack v24.05.4 milestone Jul 17, 2024
@ssddanbrown
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants