title: How to pass password from file to mysql command?
body: <p>I have a shell script which calls the mysql command with one parameter from external file, it looks like this (also I saw this example in other resources):</p>
  
  <pre><code>mysql --user=root --password=`cat /root/.mysql`
  </code></pre>
  
  <p>Bit it not working:</p>
  
  <blockquote>
    <p>Failed to connect to MySQL server: Access denied for user 'root'@'localhost' (using password: YES).</p>
  </blockquote>
  
  <p>I tried different quotes without success. How to pass it?</p>
  
  <p>UPDATE 1:
  Found that I can pass password without space symbol. The problem in this, my root pass contains spaces.</p>