docker-compose-lamp
docker-compose-lamp copied to clipboard
MySQL crashing on startup
When starting up the container ('docker-compose up') MySQL appears to crash with an error, and the startup process is caught up in a loop as it tries again and again. Attached is the output of what I believe to be the whole "cycle."
which Branch / PHP Version are you using ? php74
Desktop (please complete the following information):
- OS: MacOS 14.4 (Intel)
- Docker Version: 25.0.3 mysql-startup-error.txt
Think this is due to MYSQL update?
Edited: ./bin/mysql8/Dockerfile
Comment the following:
FROM mysql:8
RUN echo "[mysqld]" >> /etc/mysql/my.cnf
#RUN echo "default-authentication-plugin=mysql_native_password" >> /etc/mysql/my.cnf
Edit docker-compose file, and enter the following:
volumes:
- ${MYSQL_INITDB_DIR-./config/initdb}:/docker-entrypoint-initdb.d
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
command: --mysql-native-password=ON
After doing the above I can now boot up the MYSQL instance without it going into a restart loop. (After rebuilding with docker compose up --build)
Think this is due to MYSQL update?
Edited: ./bin/mysql8/Dockerfile
Comment the following:
FROM mysql:8 RUN echo "[mysqld]" >> /etc/mysql/my.cnf #RUN echo "default-authentication-plugin=mysql_native_password" >> /etc/mysql/my.cnf
Edit docker-compose file, and enter the following:
volumes: - ${MYSQL_INITDB_DIR-./config/initdb}:/docker-entrypoint-initdb.d - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql command: --mysql-native-password=ON
After doing the above I can now boot up the MYSQL instance without it going into a restart loop. (After rebuilding with docker compose up --build)
I have tried this, but I keep getting the following errors.
2024-05-26 14:55:55 2024-05-26T11:55:55.345551Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2024-05-26 14:55:55 2024-05-26T11:55:55.345622Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2024-05-26 14:55:55 2024-05-26T11:55:55.345708Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-05-26 14:55:56 2024-05-26T11:55:56.876894Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.0) MySQL Community Server - GPL.
2024-05-26 14:55:56 2024-05-26T11:55:56.876925Z 0 [System] [MY-015016] [Server] MySQL Server - end.
Operation System: Win11
Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
I solved this problem by cleaning the "data" folder.
Then I rebuilt with docker-compose -d --build
, it opened no problem thanks 👍