Docker Community Forums

Share and learn in the Docker community.

Docker Mysql : pipe in multiple sql scripts

It is suggested mysql image can also be used as a client for non-Docker or remote instances as:

docker run -it --rm mysql mysql --host=“hostname” --user=“username” --password=“password” < script.sql;

will it be able to accept multiple sql script files in one command? what’s the right format?

docker run -it --rm mysql mysql --host=“hostname” --user=“username” --password=“password” < script1.sql, script2.sql; – this NOT work

Thanks!

Give this a try:

docker run -it --rm mysql mysql --host=“hostname” --user=“username” --password=“password” <(cat script.sql script1.sql)
2 Likes