I am trying to make my own mail service using Postfix, but I run into an issue in the setup phase, and it's that postfix can't connect to the database. Here's what the error log says:
⛔Database connection string : mysql:host=localhost;dbname=postfixadmindb;charset=UTF8
⛔Problem connecting to database, check database configuration ($CONF['database_*'] entries in config.local.php)
⛔SQLSTATE[HY000] [2002] Permission denied
Here's the config file:
<?php
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfixuser';
$CONF['database_password'] = 'XXXXXXXX';
$CONF['database_name'] = 'postfixadmindb';
$CONF['configured'] = true;
$CONF['encrypt'] = 'md5crypt';
$CONF['setup_password'] = 'the setup password';
?>
First of all, I tried connecting to the database normally:
sudo mysql -u postfixuser -p'thecorrectpassword' -h localhost postfixadmindb
This works fine and brings me tho the MariaDB shell as expected
I then granted postfixuser
all privileges in the database, but that didn't solve the issue.
I checked the log under /var/log/mysql/error.log
but it's empty
I'm doing this on a WSL machine running Ubuntu 22.04.1 LTS, serving the postfixadmin web pages with apache.