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
新聞熱點
疑難解答