opensource community
I am using Postfix, dovecot and Postfix Admin for my complete email setup
I am using virtual users so I have installed postfix-mysql and dovecot-mysql
Issue:
My postfix service is not able to connect to MySQL server. Throwing:
May 19 19:52:18 mail postfix/trivial-rewrite[1600937]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
May 19 19:52:18 mail postfix/trivial-rewrite[1600937]: warning: virtual_alias_domains: mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf: table lookup problem
May 19 19:52:18 mail postfix/trivial-rewrite[1600937]: warning: virtual_alias_domains lookup failure
May 19 19:52:18 mail postfix/trivial-rewrite[1600937]: warning: virtual_alias_domains: mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf: table lookup problem
May 19 19:52:18 mail postfix/trivial-rewrite[1600937]: warning: virtual_alias_domains lookup failure
My /etc/postfix/sql/mysql_virtual_alias_maps.cf
looks like:
user = root
password = "mypass"
hosts = localhost
dbname = postfixadmin
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'
#expansion_limit = 100
Additional Info:
The MySQL setup is correct. The bind address is 0.0.0.0
, and the root user has all hosts allowed (%)
I can connect to MySQL from MySQL CLI using host 127.0.0.1
as well as localhost
Also, dovecot-mysql and postfix-admin are both able to connect to MySQL using the same config param
Help is much appreciated!
edit: Output of ss:
u_str LISTEN 0 70 /var/run/mysqld/mysqlx.sock 9448594 * 0 users:(("mysqld",pid=1599671,fd=22))
u_str LISTEN 0 151 /var/run/mysqld/mysqld.sock 9448596 * 0 users:(("mysqld",pid=1599671,fd=25))
Even if I connect to 127.0.0.1 from postfix I am getting:
May 20 14:57:09 mail postfix/trivial-rewrite[1609421]: warning: connect to mysql server 127.0.0.1: Access denied for user 'root'@'localhost' (using password: YES)
May 20 14:57:09 mail postfix/trivial-rewrite[1609421]: warning: virtual_alias_domains: mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf: table lookup problem
Access denied for user 'root'@'localhost' (using password: YES)
means either wrong password or noUSAGE
grant for that user on the given database.