title: Executing mutiple MySQL Queries in bash script
body: <p>I need to run a monthly bash script via cron that is related to our company's billing system.  This is done with two stored procedures.  When I run them via the MySQL console and workbench, they work fine.</p>
  
  <p>I've looked at <a href="https://stackoverflow.com/questions/8055694/how-to-execute-a-mysql-command-from-a-shell-script">this article</a> and this is basically the way I do it.  </p>
  
  <p>I call via cron, a shell script that looks like this:</p>
  
  <pre><code>mysql -h 192.168.1.1 -u&lt;username&gt; -p&lt;password&gt; mydatabase &lt; /path/to/billing_periods.sql
  </code></pre>
  
  <p>My text file that has the commands in it looks like this:</p>
  
  <pre><code>call sp_start_billing_period();
  call sp_bill_clients();
  </code></pre>
  
  <p>What happens is that the first query runs, but the second one on the second line, doesn't.</p>
  
  <p>I can make a stored procedure that wraps these two - but I just was hoping to learn why this was happening... Perhaps a mistake I made or a limit in the way you do this..</p>
  
  <p>I also considered doing this (two calls to the MySQL shell):</p>
  
  <pre><code>mysql -h 192.168.1.1 -u&lt;username&gt; -p&lt;password&gt; mydatabase -e "call sp_start_billing_period();"
  
  mysql -h 192.168.1.1 -u&lt;username&gt; -p&lt;password&gt; mydatabase -e "call sp_bill_clients();"
  </code></pre>