Table 'messenger_messages' already exists - example/basic
tenup11 opened this issue · 6 comments
After setting up Mautic via Docker based on example/basic I get an error during the installation step via the web UI.
Error:
An error occurred while attempting to install the data: An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'messenger_messages' already exists
This happens on Debian 12 (fresh install) with nginx proxy manager also running via docker.
Same problem here. Docker compose file:
version: '3'
x-mautic-volumes:
&mautic-volumes
- ./mautic/mautic/config:/var/www/html/config:z
- ./mautic/mautic/logs:/var/www/html/var/logs:z
- ./mautic/mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/mautic/media/images:/var/www/html/docroot/media/images:z
- ./mautic/cron:/opt/mautic/cron:z
services:
mautic_db:
image: mysql:8.0
container_name: mautic_db
hostname: db.mautic
environment:
- MYSQL_HOST=${MYSQL_HOST}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- TZ=${TIMEZONE}
volumes:
- ./mautic/mysql-data:/var/lib/mysql
healthcheck:
test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping
start_period: 5s
interval: 5s
timeout: 5s
retries: 10
networks:
- mautic
mautic_web:
image: mautic/mautic:5-apache
container_name: mautic_web
links:
- mautic_db:mysql
volumes: *mautic-volumes
environment:
- TIMEZONE=${TIMEZONE}
- DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA}
- DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS}
labels:
- "traefik.enable=true"
- "traefik.docker.network=docker_web"
- "traefik.http.routers.mautic.rule=Host(xxxxx
)"
- "traefik.http.routers.mautic.entrypoints=websecure"
- "traefik.http.services.mautic.loadbalancer.server.port=80"
- "traefik.http.routers.mautic.service=mautic"
- "traefik.http.routers.mautic.tls.certresolver=leresolver"
env_file:
- .mautic_env
healthcheck:
test: curl http://localhost
start_period: 5s
interval: 5s
timeout: 5s
retries: 100
depends_on:
mautic_db:
condition: service_healthy
networks:
- web
- mautic
mautic_cron:
image: mautic/mautic:5-apache
container_name: mautic_cron
links:
- mautic_db:mysql
volumes: *mautic-volumes
environment:
- TIMEZONE=${TIMEZONE}
- DOCKER_MAUTIC_ROLE=mautic_cron
env_file:
- .mautic_env
depends_on:
mautic_web:
condition: service_healthy
networks:
- mautic
mautic_worker:
image: mautic/mautic:5-apache
container_name: mautic_worker
links:
- mautic_db:mysql
volumes: *mautic-volumes
environment:
- TIMEZONE=${TIMEZONE}
- DOCKER_MAUTIC_ROLE=mautic_worker
env_file:
- .mautic_env
depends_on:
mautic_web:
condition: service_healthy
networks:
- mautic
volumes:
mysql-data:
networks:
web:
driver: bridge
mautic:
driver: bridge
I already tried to recreate database and drop the tables.
i got the same error. I was using basic example. I simplify docker-compose and change to Mariadb:latest and its gone.
follow the unique file docker-compose.yml working...
`version: '3.9'
services:
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root_pwd
MYSQL_DATABASE: mautic_db
MYSQL_USER: mautic_db_user
MYSQL_PASSWORD: mautic_db_pwd
volumes:
- mariadb-data:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mariadb-admin ping -h localhost -u$$MYSQL_USER --password=$$MYSQL_PASSWORD"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- default
mautic_web:
image: mautic/mautic:5-apache
ports:
- 8001:80
volumes:
- ./mautic/config:/var/www/html/config:z
- ./mautic/logs:/var/www/html/var/logs:z
- ./mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/media/images:/var/www/html/docroot/media/images:z
- ./cron:/opt/mautic/cron:z
environment:
- DOCKER_MAUTIC_LOAD_TEST_DATA=false
- DOCKER_MAUTIC_RUN_MIGRATIONS=false
- MAUTIC_DB_HOST=mariadb
- MAUTIC_DB_USER=mautic_db_user
- MAUTIC_DB_PASSWORD=mautic_db_pwd
- MAUTIC_DB_NAME=mautic_db
- MAUTIC_DB_PORT=3306
healthcheck:
test: curl http://localhost
start_period: 5s
interval: 5s
timeout: 5s
retries: 100
depends_on:
mariadb:
condition: service_healthy
mautic_cron:
image: mautic/mautic:5-apache
volumes:
- ./mautic/config:/var/www/html/config:z
- ./mautic/logs:/var/www/html/var/logs:z
- ./mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/media/images:/var/www/html/docroot/media/images:z
- ./cron:/opt/mautic/cron:z
environment:
- DOCKER_MAUTIC_ROLE=mautic_cron
depends_on:
mautic_web:
condition: service_healthy
networks:
- default
mautic_worker:
image: mautic/mautic:5-apache
volumes:
- ./mautic/config:/var/www/html/config:z
- ./mautic/logs:/var/www/html/var/logs:z
- ./mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/media/images:/var/www/html/docroot/media/images:z
- ./cron:/opt/mautic/cron:z
environment:
- DOCKER_MAUTIC_ROLE=mautic_worker
depends_on:
mautic_web:
condition: service_healthy
networks:
- default
volumes:
mariadb-data:
networks:
default:`
I tried to solve the problem for two days. And I figured out how to bypass it.
You need to stop the container with the worker service to solve the problem.
This problem occurs because the worker, for some reason, constantly recreates the messenger_messages table.
Same mistake, not fixed yet
Workaround for newbies:
comment these settings in .mautic_env:
#MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default"
#MAUTIC_MESSENGER_DSN_HIT="doctrine://default"