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]: (3540852-05) (!)connect_to_sql: unable to connect to DSN 'DBI:MariaDB:database=danami_warden;host=127.0.0.1': Host '127.0.0.1' is not allowed to connect to this MariaDB server
Apr  4 11:01:15 alma amavis[3540852]: (3540852-05) (!!)TROUBLE in check_mail: gen_mail_id FAILED: connect_to_sql: unable to connect to any dataset at /usr/share/perl5/vendor_perl/Amavis/Out/SQL/Connection.pm line 255.
Apr  4 11:01:15 alma postfix/cleanup[3534095]: 8AD7A1004203BC: milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.5.0 Error in processing, id=3540852-05, gen_mail_id FAILED: connect_to_sql: unable to connect to any dataset at /usr/share/perl5/vendor_perl/Amavis/Out/SQL/Connection.pm line 255.; from=<root@alma.example.com> to=<root@alma.example.com>
Apr  4 11:01:15 alma psa-pc-remote[424364]: Message aborted.

1. Skip-name-resolve Enabled

This can be caused because skip-name-resolve is enabled in the MariaDB config. To fix this edit the file /etc/my.cnf and any files in /etc/my.cnf.d/ and comment out or remove the line skip-name-resolve = 1 . Then restart mariadb.

systemctl restart mariadb

2. Corrupted DB Credential Issues

This can also be caused by a missing or corrupted DB credentials in the Warden config. Admins can reset the credentials using the instructions below:

// reset the Amavis database credentials
warden --task=contentfilter:contentfilter --default=yes --reload=yes

// reset the SpamAssassin learning database credentials
warden --task=antispam:learning --default=yes --reload
  • mariadb, skip-name-resolve
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

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 ::1 [Cannot assign requested address] 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]:...

How can I fix the error: Error [Contentfilter_Settings_Contentfilter]. Message [[QUARANTINEDIR] must be a valid directory?

This error means that Amavis was not installed correctly. Try running the Warden from the command...

How can I fix the error: host 127.0.0.1[127.0.0.1] said: 552 5.3.4 Declared message size (1208029 B) exceeds size limit for recipient?

You can set the message size limit for Amavis under Settings -> Policy Settings -> Misc...