When I run sail instead of docker compose, it works fine with this command.
sail mariadb mysql --user=... --password=... db < db.sql
But I need to have it working with the docker command.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I need to execute the mysql command inside a docker container.
I have an init.sql file generated with mysqldump.
docker exec app--mariadb mysqldump --user=username --password=userpassword --ignore-table=messages appdatabase > init.sql
And I want to inject it into the database.
docker exec app-mariadb mysql --user=username --password=userpassword appdatabase < init.sql
But this command doesn't do anything and I get no error.
I have checked the content of the file and all seems to be ok.
How can I solve this ?
Thanks for your help.
V
I still don't know why it doesn't work, but I worked around the problem.
I have created an artisan command and I execute it with docker compose run --rm artisan and it works fine.
Please or to participate in this conversation.