title: How do I pass a variable to a mysql script?
body: <p>I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this:</p>
  
  <pre><code>mysql&gt; source script.sql
  </code></pre>
  
  <p>How do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a department, I want to be able to pass in the number of the department as a variable.</p>
  
  <p>I am not trying to run queries through a shell script. There are simple queries I run from the mysql command line. I'm tired of retyping them all the time, and writing a shell script for them would be overkill.</p>