Fix MySQL NFS permission issues

- Run MySQL container as root (user: 0:0) to handle NFS mount permissions
- Add --user=mysql flag to MySQL command to switch to mysql user after initialization
- This resolves 'Permission denied' errors when using NFS volumes for MySQL data
This commit is contained in:
Deckard
2025-09-27 16:30:55 -04:00
parent 12090955c6
commit 7325c3347f

View File

@@ -9,6 +9,7 @@ services:
ac-mysql:
image: mysql:8.0
container_name: ac-mysql
user: "0:0" # Run as root to handle NFS permissions
environment:
MYSQL_ROOT_PASSWORD: ${DOCKER_DB_ROOT_PASSWORD:-password}
MYSQL_ROOT_HOST: '%'
@@ -23,6 +24,7 @@ services:
- --max_connections=1000
- --innodb-buffer-pool-size=256M
- --innodb-log-file-size=64M
- --user=mysql
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-p${DOCKER_DB_ROOT_PASSWORD:-password}"]