Postmap 返回数据库未找到错误

Postmap 返回数据库未找到错误

我已经用 Mysql 映射设置了我的 Postfix 配置,非常详细 这里这里

我在 /etc/postfix/mysql-virtual-mailbox-domains.cf 有一个文件,其中包含以下内容:

 user = mailuser
 password = fLxsWdf5ABLqwhZr
 hosts = 127.0.0.1
 dbname = mailserver
 query = SELECT 1 FROM virtual_domains WHERE name='%s'

它与 /etc/postfix/main.cf 中的以下行相链接:

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf

当我使用 postmap 时

postmap -qv [email protected] mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf

我收到以下错误:

fatal: open database [email protected]: No such file or directory

显然没有数据库”[电子邮件保护]“但我希望它能出现在“邮件服务器”数据库中。

附加信息 ~~~~~~~~~~~ 添加这一点是为了排除拼写错误的可能性(上面的 dave@ 是拼写错误):

sudo cat /etc/postfix/mysql-virtual-mailbox-domains.cf 
user = mailuser
password = xxxxxxxxxxxxxxxxxx
hosts = 127.0.0.1
dbname = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s'
dave@server:~$ postmap -qv example.co.za mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
postmap: fatal: open database example.co.za.db: No such file or directory
dave@server:~$ 

. 检查查询是否有效:

 mysql -u mailuser -p
 Enter password: 
 Welcome to the MariaDB monitor.  Commands end with ; or \g.
 Your MariaDB connection id is 1922
 Server version: 10.1.38-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 MariaDB [(none)]> connect mailserver
 Reading table information for completion of table and column names
 You can turn off this feature to get a quicker startup with -A

 Connection id:    1923
 Current database: mailserver

 MariaDB [mailserver]> SELECT 1 FROM virtual_domains WHERE name='example.co.za';
 +---+
 | id | name            |
 +---+
 |  6 | example.co.za |
 +---+
 1 row in set (0.00 sec)

答案1

看起来您刚刚打错了。应该是postmap -q,而不是postmap -qv

相关内容