1

(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 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (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 127.0.0.1, I opened 3306 for 127.0.0.1 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

1 Answers1

1

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:

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

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 127.0.0.1:3306          0.0.0.0:*               LISTEN

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

# mysql -u mailuser -h 127.0.0.1 -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!