0

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)

Falco
  • 1,458
  • 3
  • 19
  • 47

1 Answers1

1

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.

vonPryz
  • 22,996
  • 7
  • 54
  • 65