title: Ansible unable to find .my.cnf Can't connect to local MySQL server
body: <p>Since 6 hours I'm trying to find out how ansible wants to work with my mariadb on ubuntu 16.</p>
  
  <p>When I manually log in on the server with </p>
  
  <blockquote>
    <p>mysql -u someuser -p</p>
  </blockquote>
  
  <p>everything works fine</p>
  
  <p>when I try to access the server with the ansible script with:</p>
  
  <pre><code>  - name: Create mysql database
      mysql_user: name=someuser state=present password=somepw
  </code></pre>
  
  <p>its complaining:</p>
  
  <blockquote>
    <p>fatal: [IP]: FAILED! => {"changed": false, "failed": true,
    "msg": "unable to connect to database, check login_user and
    login_password are correct or /home/someuser/.my.cnf has the
    credentials. Exception message: (2002, \"Can't connect to local MySQL
    server through socket '/tmp/mysql.sock' (2)\")"}</p>
  </blockquote>
  
  <p>Then I try to put .my.cnf into the directory on the remote server like it is trying to tell me.
  I also added login_user and login_password. No help. </p>
  
  <p>The file looks like this:</p>
  
  <p>/home/someuser/.my.cnf</p>
  
  <pre><code> [client] 
   user=someuser
   password=somepw
  </code></pre>
  
  <p>"Okay" I thought. Maybe the credentials are doubled in the ansible script and in the conf file. I tried to leave the conf file or to skip the credentials in the ansible script. No help</p>
  
  <p>I also restarted the mysql server. No help. The strange thing is, that from the server itself everything worked with the mysql shell.
  I'm really struggleing to find the solution. Shouldn't this work just like a charm?</p>