How can I fix the error: unable to connect to DSN 'DBI:MariaDB:database=danami_warden;host=localhost'?

You see errors like this in the mail log:

Jan 1 03:30:45 busy-gates amavis[18902]: (18902-01) (!)connect_to_sql: unable to connect to DSN 'DBI:MariaDB:database=danami_warden;host=localhost': Can't connect to local server through socket '/var/lib/mysql/mysql.sock' (13) Jan 1 03:30:45 busy-gates amavis[18902]: (18902-01) (!!)TROUBLE in check_mail: gen_mail_id FAILED: connect_to_sql: unable to connect to any dataset at (eval 100) line 253.

SELinux Issues

SELinux issues with rpm based systems using MariaDB 10.5+ with SELinux enabled. This can be caused by a a bug in MariaDB where it is not setting the correct SELinux context on the MariDB socket so nothing can connect to it (MDEV-24941 bug report). To fix the issue:

Run the following command:

chcon system_u:object_r:mysqld_exec_t:s0 /usr/sbin/mariadbd && systemctl restart mariadb.service

This should fix the issue until MariaDB fixes their RPM packages.

Corrupted DB Credentials

This can also be caused by a missing or corrupted DB credentials in the Warden config. Admins can go though the Warden setup wizard again and Warden will try to repair the issue. See here for more information.

 

  • selinux, socket
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I fix the error: Host '127.0.0.1' is not allowed to connect to this MariaDB server?

When looking at the server mail log you see this: Apr 4 11:01:15 alma amavis[3540852]:...

ClamAV will not start. How can I fix the ClamAV error: daily.{c[vl]d,inc} was not met?

ClamAV refuses to start and when viewing the status you see...

How can I fix any statistics generation problems?

Missing the Warden Crontab Entry There is a crontab entry that will update Warden statistics...

How can I fix the error: "milter-reject: END-OF-MESSAGE from..." in the log and found the AV in error (cannot read /etc/clam.d/scan.conf).

Cloudlinux / Imunify360 added their own version of ClamAV to their repo which accidentally...

How can I fix the error: Can't connect to TCP port 10024 on 127.0.0.0 [Address already in use] when trying to start Amavis?

When trying to start Amavis you see this in the mail log: Oct 02 03:20:15 condor3648 systemd[1]:...