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

UP: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.posts' doesn't exist #48

Closed
Justuser3310 opened this issue Dec 19, 2023 · 4 comments

Comments

@Justuser3310
Copy link

Duplicate of https://github.com/m1k1o/blog/issues/28

Config:

version: "3"
services:
  webserver:
    image: m1k1o/blog:latest
    container_name: blog_apache
    environment:
      TZ: Europe/Moscow
      BLOG_DB_CONNECTION: mysql
      BLOG_MYSQL_HOST: mariadb
      BLOG_MYSQL_PORT: 3306
      BLOG_MYSQL_USER: blog
      BLOG_MYSQL_PASS: blog # use secure password
      BLOG_DB_NAME: blog
    restart: unless-stopped
    ports:
      - 9999:80
    volumes: 
      - ${DATA-./data}:/var/www/html/data
  mariadb:
    image: mariadb:10.1
    container_name: blog_mariadb
    environment:
      MYSQL_USER: blog
      MYSQL_PASSWORD: blog # use secure password
      MYSQL_DATABASE: blog
      MYSQL_ROOT_PASSWORD: root # use secure password
    restart: unless-stopped
    volumes:
      - mariadb:/var/lib/mysql
      - ./app/db/mysql:/docker-entrypoint-initdb.d:ro
volumes:
  mariadb:
@m1k1o
Copy link
Owner

m1k1o commented Dec 19, 2023

Do you have ./app/db/mysql directory available? There must be schema that is automatically created. This file must be in there: https://github.com/m1k1o/blog/tree/master/app/db/mysql

@Justuser3310
Copy link
Author

No, fixed it:
sudo chmod 777 app/db/mysql/
cd app/db/mysql/ && wget https://raw.githubusercontent.com/m1k1o/blog/master/app/db/mysql/01_schema.sql

Then... The same problem.

@m1k1o
Copy link
Owner

m1k1o commented Dec 20, 2023

You need to remove the mariadb volume and start again so that it performs the initialization.

# this removes volumes
docker-compose down -v

@Justuser3310
Copy link
Author

It worked.

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

2 participants