title: MySQL from the command line - can I practically use LOCKs?
body: <p>I'm doing a bash script that interacts with a MySQL datatabase using the <code>mysql</code> command line programme. I want to use table locks in my SQL. Can I do this?</p>
  
  <pre><code>mysql -e "LOCK TABLES mytable"
  # do some bash stuff
  mysql -u "UNLOCK TABLES"
  </code></pre>
  
  <p>The reason I ask, is because table locks are only kept for the session, so wouldn't the lock be released as soon as that mysql programme finishes?</p>