m1k1o / blog

Lightweight self-hosted facebook-styled PHP blog.
https://blog.m1k1o.net
GNU General Public License v3.0
300 stars 31 forks source link

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

Closed Justuser3310 closed 8 months ago

Justuser3310 commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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

# this removes volumes
docker-compose down -v
Justuser3310 commented 8 months ago

It worked.