How can I start mysql interactive mode from the command line, with a list of commands to run one-by-one at different prompts as if I had typed them?
printf "use my_db;\nselect * from my_table;\n" | mysql -u root -p
doesn't work, I guess because mysql
detects it's not running in a tty
And I can't try
printf "use my_db;\nselect * from my_table;\n" | script -qfec "mysql -u root -pMyPassword" /dev/null
because the docker container I'm in has no script
command