Usually you would run the MySQL client to import an SQL file like this:
mysql -uexample_user -p example_database < filename.sql It will then ask for the password and after the correct password was provided it will execute the SQL statements in filename.sql. This interactive password prompt reduces the risk of the password ending up in the shell history.
When MySQL is running inside a Docker container one could assume that you could do the same using this command:
docker exec container_name mysql -uexample_user -p example_database < filename.sql But this is not the case. MySQL will not ask for a password when using this command.
What is the correct docker command to allow MySQL to ask for the password?