3、与MySQL结合的配置及数据表结构
注意:配置mysql相关部分要写127.0.0.1而不要写localhost,如果使用localhost,postfix会尝试socket连接。debian的postfix使用socket连接好像有问题。mysql不能使用skip-networking选项,要使用--bind-address=127.0.0.1让它监听在127.0.0.1。(非常感谢MartinList-Petersen指点)
还有要注意的是如果是自己编译的mysql,建议在启动的时候加上--socket=/var/run/mysqld/mysqld.sock参数,因为pam-mysql又需要使用这个socket。如果你的apache+php是自己编译的话,php又需要重新编译,配置的时候需要加上--with-mysql-sock=/var/run/mysqld/mysqld.sock参数。
是不是比较烦?这不过是个开始。
MySQL的数据表:
以下为引用的内容:
CREATETABLEalias(
idint(11)unsignedNOTNULLauto_increment,
aliasvarchar(128)NOTNULLdefault'',
destinationvarchar(128)NOTNULLdefault'',
PRIMARYKEY(id)
)TYPE=MyISAM;
CREATETABLErelocated(
idint(11)unsignedNOTNULLauto_increment,
emailvarchar(128)NOTNULLdefault'',
destinationvarchar(128)NOTNULLdefault'',
PRIMARYKEY(id)
)TYPE=MyISAM;
CREATETABLEtransport(
idint(11)unsignedNOTNULLauto_increment,
domainvarchar(128)NOTNULLdefault'',
destinationvarchar(128)NOTNULLdefault'',
PRIMARYKEY(id),
UNIQUEKEYdomain(domain)
)TYPE=MyISAM;
CREATETABLEusers(
idint(11)unsignedNOTNULLauto_increment,
emailvarchar(128)NOTNULLdefault'',
clearvarchar(128)NOTNULLdefault'',
nametinytextNOTNULL,
uidint(11)unsignedNOTNULLdefault'1011',
gidint(11)unsignedNOTNULLdefault'1011',
homedirtinytextNOTNULL,
maildirtinytextNOTNULL,
quotatinytextNOTNULL,
postfixenum('Y','N')NOTNULLdefault'Y',
PRIMARYKEY(id),
UNIQUEKEYemail(email)
)TYPE=MyISAM;
CREATETABLEvirtual(
idint(11)unsignedNOTNULLauto_increment,
emailvarchar(128)NOTNULLdefault'',
destinationvarchar(128)NOTNULLdefault'',
PRIMARYKEY(id)
)TYPE=MyISAM;
/etc/postfix目录下各mysql配置文件:
mysql-aliases.cf
user=mysql-postfix-user
password=mysql-postfix-pass
dbname=postfix
table=alias
select_field=destination
where_field=alias
hosts=127.0.0.1
mysql-relocated.cf
user=mysql-postfix-user
password=mysql-postfix-pass
dbname=postfix
table=relocated
select_field=destination
where_field=email
hosts=127.0.0.1
mysql-transport.cf
user=mysql-postfix-user
password=mysql-postfix-pass
dbname=postfix
table=transport
select_field=destination
where_field=domain
hosts=127.0.0.1
新闻热点
疑难解答