How can i run a mysql query from a script via the ubuntu command line using the mysql client? I know i can use the following command:
mysql -uroot -psecret -e "select * ..."
But my query is too big and would like to be read from a script instead. I tried the following and did not work:
mysql -uroot -psecret < /path/to/script.sql
i get the error:
ERROR 1046 (3D000) at line 1: No database selected