MYSQL_TABLE(5) File Formats Manual MYSQL_TABLE(5) (NAME) mysql_table - MySQL/MariaDB Postfix (SYNOPSIS) ?Bpostmap -q "?Istring?B" mysql:/etc/postfix/?Ifilename?R ?Bpostmap -q - mysql:/etc/postfix/?Ifilename?B (DESCRIPTION) Postfix . ?Blmdb:?R ?Bcdb:?R ?Bhash:?R ?Bdbm:?R . MySQL . Postfix <> . MySQL MySQL main.cf : alias_maps = mysql:/etc/postfix/mysql-aliases.cf etc/postfix/mysql-aliases.cf/ main.cf . Postfix 'mysql' MariaDB/MySQL Postfix . . (LIST MEMBERSHIP) SQL mynetworks$ mydestination$ relay_domains$ local_recipient_maps$ . * * . "Postfix lists versus tables" DATABASE_README . mydestination$ relay_domains$ IP mynetworks$ . . SQL . MYSQL (MYSQL PARAMETERS) ?Bhosts?R Postfix . ?Iunix:?R TCP ?Iinet:?R () . : hosts = inet:host1.some.domain inet:host2.some.domain:port hosts = host1.some.domain host2.some.domain:port hosts = unix:/file/name TCP . . 2.0 . : localhost ( ?Iinet:?R) MySQL . MySQL localhost TCP : hosts = 127.0.0.1 : ?Bhosts?R (load balancer) . 3.9 . ?Buser?R ?Bpassword?R MySQL. : user = someone password = some_password ?Bdbname?R . : dbname = customer_database ?Bcharset (: utf8mb4)?R MySQL (collation) . 3.9 Postfix . MySQL (?Butf8mb4?R MySQL 8.0 ?Blatin1?R). ?Bidle_interval (: 60)?R . 3.9 Postfix . ?Bretry_interval (: 60)?R . : ?Bhosts?R . 3.9 . 3.9 Postfix . ?Bquery?R SQL ?B%s?R Postfix : query = SELECT replacement FROM aliases WHERE mailbox = '%s' ( ) <> ( Postfix 3.2 ) << >> . '%' : ?B%%?R '%' . ?B%s?R . SQL . ?B%u?R user@domain ?B%u?R ( SQL) . . . ?B%d?R user@domain ?B%d?R ( SQL) . . ?B%[SUD]?R ?Bquery?R . ?Bresult_format?R ( ) . ?B%[1-9]?R %1 %2 ... %9 . ?Iuser@mail.example.com?R %1 ?Bcom?R %2 ?Bexample?R %3 ?Bmail?R . . ?Bdomain?R . ?Bdomain?R SQL . 2.2 Postfix . SQL : ?Bselect_field?R ?Btable?R ?Bwhere_field?R ?Badditional_conditions?R. : SELECT [?Bselect_field?R] FROM [?Btable?R] WHERE [?Bwhere_field?R] = '%s' [?Badditional_conditions?R] '%s' ?BWHERE?R . 2.2 ?Bquery?R . : query . ?Bresult_format (: ?B%s?R)?R . ( ) . '%' : ?B%%?R '%' . ?B%s?R . . ?B%u?R user@domain ?B%u?R . . ?B%d?R user@domain ?B%d?R . . ?B%[SUD1-9]?R . ?Bquery?R . "result_format = smtp:[%s]" mailHost transport(5) . . expansion_limit . ?B%s?R . 2.2 Postfix . : (result_format) ! ?Bdomain (: )?R "type:table" . ** : 'user' "domain@" . MySQL . domain = postfix.org, hash:/etc/postfix/searchdomains SQL SQL . 2.2 Postfix . : local(8) . ?Bexpansion_limit (: 0)?R ( ). . . 1 . ?Boption_file?R my.cnf. ?B[client]?R ?Boption_group?R . 2.11 Postfix . ?Boption_group (: Postfix >=3.2 client <= 3.1 )?R mysql ?B[client]?R. 3.2 ?B[client]?R . ?Boption_file?R "?Boption_group =?R" ( ) . 2.11 Postfix . ?Brequire_result_set (: yes)?R "?Byes?R" . "?Bno?R" << >> . 3.2 Postfix . TLS (TLS-RELATED SETTINGS) MYSQL_OPT_SSL_* https://dev.mysql.com/doc/c-api/en/mysql-options.html https://mariadb.com/kb/en/mysql_optionsv . ?Btls_cert_file?R X509 . 2.11 Postfix . ?Btls_key_file?R ?Btls_cert_file?R. 2.11 Postfix . ?Btls_CAfile?R X509 . ?Btls_CApath?R . 2.11 Postfix . ?Btls_CApath?R X509 . 2.11 Postfix . ?Btls_ciphers?R SSL. 2.11 Postfix . ?Btls_verify_cert (: no)?R (CN) . 2.11 Postfix . MYSQL (USING MYSQL STORED PROCEDURES) 3.2 (stored procedure) SELECT query : ?Bquery?R = CALL lookup('%s') '%' . SELECT . <> << >> . . : CREATE [DEFINER=`user`@`host`] PROCEDURE `lookup`(IN `param` VARCHAR(255)) READS SQL DATA SQL SECURITY INVOKER BEGIN select goto from alias where address=param; END MAIN.CF (OBSOLETE MAIN.CF PARAMETERS) Postfix MySQL main.cf . MySQL . MySQL (_) . "mysql:?Imysqlname?R" "hosts" main.cf "?Imysqlname?R_hosts" . : MySQL main.cf . . (OBSOLETE QUERY INTERFACE) 2.2 Postfix . ?Bquery?R . ?Bquery?R . . SELECT : SELECT [?Bselect_field?R] FROM [?Btable?R] WHERE [?Bwhere_field?R] = '%s' [?Badditional_conditions?R] s% . ?Bselect_field?R "select" SQL. : ?Bselect_field?R = forw_addr ?Btable?R "select .. from" SQL. : ?Btable?R = mxaliases ?Bwhere_field?R "select .. where" SQL. : ?Bwhere_field?R = alias ?Badditional_conditions?R SQL. : ?Badditional_conditions?R = AND status = 'paid' (SEE ALSO) postmap(1), Postfix postconf(5), ldap_table(5), LDAP pgsql_table(5), PostgreSQL sqlite_table(5), SQLite (README FILES) <> <> . DATABASE_README, Postfix MYSQL_README, MYSQL Postfix (LICENSE) Secure Mailer . (HISTORY) MySQL 1.0 . (AUTHORS) : Scott Cotton, Joshua Marcus IC Group, Inc. : Liviu Daia Institute of Mathematics of the Romanian Academy P.O. BOX 1-764 RO-014700 Bucharest, ROMANIA John Fawcett. Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA MYSQL_TABLE(5)