title: mysqld_exporter doesn't connect to mariadb
body: <p>I am running and mysqld_exporter on the same server. Since I have to use ansible to configure the exporter, I used cloud-alchemy ansible role based on the official prometheus mysqld_exporte that you can see here : <a href="https://github.com/cloudalchemy/ansible-mysqld_exporter" rel="nofollow noreferrer">https://github.com/cloudalchemy/ansible-mysqld_exporter</a>.</p>
  <p>I followed both the role and exporter requirements (ansible version, mysql user) and the installation runs well with no error. Yet according to the logs the exporter can not seem to connect to the database. Here is the error that I get :</p>
  <pre><code>caller=exporter.go:149 level=error msg=&quot;Error pinging mysqld&quot; err=&quot;dial tcp 127.0.0.1:3306: connect: connection refused&quot;
  </code></pre>
  <p>Here is my default/main.yaml looks like on the role :</p>
  <pre><code>---
  mysqld_exporter_binary_local_dir: &quot;&quot;
  mysqld_exporter_version: 0.14.0
  mysqld_exporter_web_listen_address: &quot;0.0.0.0:9104&quot;
  
  mysqld_exporter_dsn: &quot;testexpo:xxxx@(localhost:3306)/&quot;
  
  mysqld_exporter_my_cnf: &quot;&quot;
  
  mysqld_exporter_collect: []
  
  mysqld_exporter_no_collect: []
  </code></pre>
  <p>The dsn has been changed according to the user configured. And by the way I can access my database with this user with the command line. All of the necessary ports are open and are listening.</p>
  <p>I have tried to change the localhost part to 127.0.0.1, id did not work too.</p>
  <p>I have no idea what to try anymore, so if you guys have any idea or advice I will gladly take them ! Thanks in advance.</p>