MySQL Forums
Forum List  »  MySQL & Kubernetes

mysql entry[point script
Posted by: john chang
Date: September 28, 2022 02:01PM

hi guys,
I am running docker-compose file where it runs setup.sql file as below:

volumes:
- ./php/setup.sql:/locker-entrypoint-initdb.d/setup.sql


output of setup.sql file:
CREATE DATABASE IF NOT EXISTS `php_demo`;
USE `php_demo`;
CREATE TABLE IF NOT EXISTS `demo_table` (id int not null auto_increment primary key,name varchar(50) not null,score int);
GRANT all privileges on *.* to `user1234`@`%`;


when I look at the output of the docker compose up, it shows me the following:
db | 2022-09-28 18:58:33+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
db | 2022-09-28 18:58:33+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db | 2022-09-28 18:58:33+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.

then some lines later, I see the following:
db | 2022-09-28 18:58:39+00:00 [Note] [Entrypoint]: Creating database php_demo
db | 2022-09-28 18:58:39+00:00 [Note] [Entrypoint]: Creating user user1234
db | 2022-09-28 18:58:39+00:00 [Note] [Entrypoint]: Giving user user1234 access to schema php_demo

What I want to know is why the CREATE TABLE IF NOT EXISTS command doens't get executed.

thank you

Options: ReplyQuote


Subject
Written By
Posted
mysql entry[point script
September 28, 2022 02:01PM
October 13, 2022 09:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.