(Yes, this question seems very similar, but I understand why I get the message. What I don't get, and can't find any palpable information about on my own, is what to do about it. So here I am.)

I am trying to set up Postfix and Dovecot on my VPS, deciding to go the MySQL-route with MariaDB. Following this guide, which seems pretty okay.

Got as far as to test the DB config files with postmap, when the server simply refused connection. This is the error message I get;

postmap: warning: connect to mysql server Can't connect to MySQL server on '' (111 "Connection refused")
postmap: fatal: table mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf: query error: Transport endpoint is not connected

MariaDB's config file is set up to bind with, I opened 3306 for and even tried disabling the firewall altogether without any change.

It seems that the IP and port can't be to blame then, and I assume this "Transport endpoint" must be the culprit - if that's not just another way of referring to the IP/port.

If anyone has suggestions as to what I can try to get around this, I would be incredibly grateful.

Edit: If it makes any difference, I'm using nginx as well.

Edit II: Results of 'service mysql status':

* /usr/bin/mysqladmin  Ver 9.1 Distrib 10.1.11-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Server version          10.1.11-MariaDB-1~trusty-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 2 hours 37 min 16 sec
  • Output of systemctl mysqld status – Jacob Evans Jan 31 '16 at 17:46
  • @JacobEvans I added the output of service mysql status, which I assume does the same job. I see that it's connecting through the socket, but using localhost in the DB config for Postfix apparently is a no-go as far as all the information I've found on it is concerned. :') Maybe I should try using the UNIX socket path as host? – Aurora Vollvik Jan 31 '16 at 19:09
  • 2
    Possible duplicate of What causes the 'Connection Refused' message? – Iain Jan 31 '16 at 19:10
  • 1
    In response to your edit and as Iain suggested: Is MariaDB actually listening for TCP connections on the default port? (That's port 3306) If it is, then be aware that GRANT-ing rights for TCP connections is different from allowing access from localhost.. – HBruijn Jan 31 '16 at 19:38
  • @HBruijn Using the command "netstat -tln" shows that nothing is indeed listening on 3306. Huh. Guess I have to find out what GRANT-ing is about then. :) – Aurora Vollvik Jan 31 '16 at 19:59

I found the answer here, after HBruijn set me on the right path: https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/

MariaDB has the skip-networking directive active as default, which stops all TCP/IP connections. After commenting it out, but leaving bind-address as is I let MariaDB listen to TCP on the default port (3306) only for local connections.

Change this in my.cnf:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            =

Restarted the mysql service and tested to see what ports were listened on;

# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
..some records..
tcp        0      0*               LISTEN

Also successfully logged into MariaDB through, and everything works! Yay!

# mysql -u mailuser -h -D mailserver -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.1.11-MariaDB-1~trusty-log mariadb.org binary distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [mailserver]>It finally works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.