Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker部署方式下,数据库初始化报错 #2327

Open
alonelyshepherd opened this issue Jan 14, 2024 · 1 comment
Open

docker部署方式下,数据库初始化报错 #2327

alonelyshepherd opened this issue Jan 14, 2024 · 1 comment

Comments

@alonelyshepherd
Copy link

alonelyshepherd commented Jan 14, 2024

按照文档中第2部分进行了Docker部署,
在执行 docker exec <container_id> bash -c "mysql -uroot -Dcat < /init.sql" 命令时提示
bash: mysql -uroot -Dcat < /init.sql: No such file or directory
这个init.sql放在什么位置了?看代码库里也没有

@everiu
Copy link

everiu commented Jan 26, 2024

文档应该有误,如果查看项目中 docker/docker-compose.yml 文件可以看出来,mysql是将 /script/CatApplication.sql 这个文件挂载到mysql容器中的 docker-entrypoint-initdb.d 这个目录中,其中这个目录中的sql文件会自动执行,也就完成了初始化,不再需要手动去执行了,docker-compose部署后,本地可以直接访问

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants