I'm following the well-known tutorial, and I'm at this step
However I've got a problem when trying to run
postmap -q example.org mysql:/etc/postfix/mysql-virtual-box-domains.cf
I get:
postmap: warning: connect to mysql server 127.0.0.1: Lost connection to MySQL server at 'reading initial communication packet', system error: 0
However I am able to connect to mysqld via mysql:
mysql -u mailuser -p
, with the password "foo". The .cf looks like this:
user = mailuser
password = foo
hosts = 127.0.0.1
dbname = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s'
What could be the problem?
Addendum
The relevant part from my.cf looks like this:
# The MySQL server
[mysqld]
port = 3306
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 16K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
bind-address = 127.0.0.1
run postmap with more verbose output and post the output here. Hopefully you get some useful information out of it.
mysqld can listen both to a local socket and a tcp/ip socket. By default it connects to the local socket (which is how you are connecting to it when running "mysql" on the command line). postgres is trying to connect via a tcp/ip socket on localhost and is not succeeding.
So, make mysqld listen on both interface types (or figure out why it's not if it's supposed to be), or make postgres use the local socket.
To simulate what postgres is doing from the command line BTW, you can run it like this: