1

These are similar but not exactly the same

How to execute MySQL command from the host to container running MySQL server?

How to execute mysqldump command from the host machine to a mysql docker container

This command works pretty in Git Bash even on Windows:

docker exec -i some_docker_container mysql -uroot -psome_password mydb<tables.sql

Same command on Powershell says:

ERROR 1049 (42000): Unknown database 'mydb<tables.sql'

How to pass tables.sql file as parameter? (it contains some create tables statements)

1 Answer 1

2

The command that works in Git Bash is using input redirection. That doesn't work in Powershell, as < is reserved for future use. Since Powershell doesn't parse < as redirection, it passes string literal mydb<tables.sql as the database name. Thus, the error message.

To execute the script file, use -e "source script.sql" for invoking mysql client in batch mode processing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.