Plugins - MySQL connection errors

When configuring the MySQL Plugin you may see the following error in the Meter console:

mysql: msg connect ECONNREFUSED, name Error, stack->
mysql: Error: connect ECONNREFUSED

This error means that the plugin could not connect to the MySQL Database for some reason. Below is an explanation of the plugin configuration and some tips on ensuring connectivity.

Hostname vs Socket connection - The plugin can connect using hostname OR plugin, if you fill in both fields it will automatically attempt to connect using the Hostname. If you wish to connect using a Socket connection then leave the hostname box blank.

Where is my Socket file? - To find your socket file path you should check your my.cnf file. commonly this can be found by running

cat /etc/mysql/my.cnf

Search through this document for a section resembling the below:

port            = 3306
socket          = /var/run/mysqld/mysqld.sock

This is the port and path to the socket file that you need. Often the socket file will be a more reliable option than hostname/port

I'm using a hostname/port configuration and it is failing

In this case the first step is to confirm that a connection is possible. Log in to the server that the Meter is running on and run telnet [hostname] [port] if a connection is successful then check that your username and password are correct. If a connection is not successful then confirm that

  • There are no firewalls blocking communication
  • The hostname resolves correctly (can you ping successfully)


I've checked my connections, username, and it still doesn't work

Open a ticket with us and we'll get you fixed up as soon as possible, you'll find a link below.


Have more questions? Submit a request