Skip to content

Problem installing Ghost with docker-compose #232

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

Closed
Encang-Cutbray opened this issue Sep 20, 2020 · 7 comments
Closed

Problem installing Ghost with docker-compose #232

Encang-Cutbray opened this issue Sep 20, 2020 · 7 comments

Comments

@Encang-Cutbray
Copy link

Encang-Cutbray commented Sep 20, 2020

Hai, i have a problem to install ghost with docker-compose
the problem is
ERROR ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
"Unknown database error"
Error ID:
500
Error Code:
ER_NOT_SUPPORTED_AUTH_MODE

my docker-compose

version: "3.1"
services:
  ghost:
    image: ghost:latest
    restart: always
    networks:
      - ghost-lover
    ports:
      - 8080:2368
    environment:
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      url: http://localhost:8080

  db:
    image: mysql:latest
    networks:
      - ghost-lover
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - mysql-lover:/var/lib/mysql

volumes:
  mysql-lover:
networks:
  ghost-lover:

can do you help me? thank

@acburdine
Copy link
Collaborator

@Encang-Cutbray the reason this is occurring I think is because mysql:latest installs MySQL version 8, which currently has a couple of known incompatibilities with the nodejs MySQL driver.

To fix this, try updating your db image to mysql:5.7 instead.

@Encang-Cutbray
Copy link
Author

Encang-Cutbray commented Sep 22, 2020

@acburdine yes, I used mysql:latest for my database, and i changed to mysql:5.7, it is working now, thanks for information about known incompatibilities mysql 8.0 thank you very much

@heng1025
Copy link

heng1025 commented Aug 8, 2021

@acburdine ghost 4+ has supported mysql 8.0,maybe you need open mysql_native_password.
Here is the example:

  • Run a container independently
    docker run --name db -e MYSQL_ROOT_PASSWORD=example -d mysql --default-authentication-plugin=mysql_native_password

  • docker-compose.yml

version: '3.8'
services:
  ghost:
    image: ghost:alpine
    restart: always
    ports:
      - 8080:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: http://localhost:8080
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
      #NODE_ENV: development

  db:
    image: mysql:latest
    restart: always
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_ROOT_PASSWORD: example

@dnsmichi
Copy link

dnsmichi commented Dec 1, 2021

@heng1025 Thanks a lot for sharing, it helped my upgrade to v4 and MySQL 8 :-)

I've created a summary blog for everyone looking into the same: https://dnsmichi.at/2021/11/30/upgrade-to-ghost-v4-with-docker-compose/

@robetus
Copy link

robetus commented Jul 23, 2024

@acburdine yes, I used mysql:latest for my database, and i changed to mysql:5.7, it is working now, thanks for information about known incompatibilities mysql 8.0 thank you very much

Don't know why it shows 8.0 in the official docs when 8.0 doesn't work. Same exact issue, worked totally fine with 5.7.

@tianon
Copy link
Member

tianon commented Jul 23, 2024

Namely because anything older than MySQL 8.0 is end of life (5.7 is no longer supported).

I've just tested, and it worked totally fine for me with mysql:8.0, but maybe I have to do something specific to encourage it to fail?

version: '3.1'

services:

  ghost:
    image: ghost:5-alpine
    restart: always
    ports:
      - 2368:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: http://my-local-system-hostname:2368
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
      #NODE_ENV: development
    volumes:
      - ghost:/var/lib/ghost/content

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - db:/var/lib/mysql

volumes:
  ghost:
  db:

(only changed port mapping and url value from the example on Docker Hub)

@robetus
Copy link

robetus commented Jul 23, 2024

On Portainer Community Edition 2.20.3 I could not get mysql 8.0 or mysql latest to work after trying multiple times, only 5.7 worked. Could be something with Portainer, I'll try to update mysql after Portainer issues an update, for now I'm running the latest CE version of it.

Also the port for the url is not needed in the compose file if you're using a reverse proxy, the port change won't make it work either. I tried multiple different ports as well, same mapped as you did and different mapped.

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

No branches or pull requests

6 participants