ZONE2SQL(1)
β¨ ZONE2SQL(1) β¨
okay so bestie, gather round, because this one is a whole vibe: zone2sql from the PowerDNS Authoritative Server family. it converts BIND zones to SQL. that's the whole personality. π
πΈ NAME πΈ
zone2sql β convert BIND zones to SQL. yes that's it, that's the girl. π
π SYNOPSIS π
zone2sql {--named-conf=PATH,--zone-file=PATH [--zone-name=NAME]}
[Options]
like. that's the shape of it. either you come in through --named-conf or you come in through the zone file route, and there's a lil --zone-name in there for when you need it. and then, obviously, options. π¦
π DESCRIPTION π
so what does she actually do? zone2sql parses BIND named.conf files and zonefiles and outputs SQL on standard output, which can then be fed to your database. standard output, bestie. she doesn't touch your DB herself, she just hands you the goods and you pipe them wherever. no cap. β¨
zone2sql understands the BIND master file extension $GENERATE and will also honour $ORIGIN and $TTL. she's not out here ignoring your directives, she sees them. π
for backends supporting secondary operation there is also an option to keep secondary zones as secondaries, and not convert them to native operation. so like, if you want them to stay secondaries, she can do that, she's flexible. π«Ά
zone2sql can generate SQL for the Generic MySQL, Generic PostgreSQL, Generic SQLite3 backend. all three. she ate. π₯
β OPTIONS β
π INPUT OPTIONS π
--named-conf=<PATH>β Read PATH to get the BIND configuration. point her at your config and she'll go off. π--zone=<PATH>β Parse only the zone file at PATH. Conflicts with--named-confparameter. so like, pick one, you cannot have both, it's giving "choose your fighter". βοΈ--zone-name=<NAME>β When parsing a single zone without$ORIGINstatement, set ZONE as the zone name. basically: if there's no$ORIGINtelling her what the zone is called, you gotta tell her yourself. π·οΈ
π BACKENDS π
--gmysqlβ Output in format suitable for the default configuration of the Generic MySQL backend. π¬--gpgsqlβ Output in format suitable for the default configuration of the Generic PostgreSQL backend. π--gsqliteβ Output in format suitable for the default configuration of the Generic SQLite3 backend. πͺΆ
β¨ OUTPUT OPTIONS β¨
--json-commentsβ Parse JSON in zonefile comments to set the'disabled'and'comment'fields in the database. See JSON COMMENTS for more information. (scroll down bestie, it's all explained π)--transactionsβ If the target SQL backend supports transactions, wrap every domain into a transaction for integrity and possibly higher speed. integrity AND speed?? she's doing both?? iconic. π§
π OTHER OPTIONS π
--delete-matching-domainsβ Adds a delete statement to the sql output to allow re-importing zones. Mostly only useful during testing. Since this will only delete the domain, but not its records, you should have the optional foreign key relationship enabled in your schema in order to avoid leaving dangling records.
β οΈ okay so real talk: this deletes the domain but NOT its records. so if you don't have that optional foreign key relationship enabled in your schema, you're gonna leave dangling records just floating around like ghosts. enable the FK, protect your peace. π»
--filter-duplicate-soaβ If there's more than one SOA record in the zone (possibly because it was AXFR'd), ignore it. If this option is not set, all SOA records in the zone are emitted. so like. either she filters the dupes or she gives you every single one, your call. π--helpβ List all options. the classic. the icon. the one everybody runs first. π--on-error-resume-nextβ Ignore missing zone files during parsing. Dangerous.
π DANGEROUS. she said what she said. missing zone files just get skipped and you don't get told. lowkey unhinged. proceed with caution bestie.
--secondaryβ Maintain secondary status of zones listed innamed.confas being slaves. The default behaviour is to convert all zones to native operation. so by default everything becomes native; this flag keeps the secondaries as secondaries. π¦--verboseβ Be verbose during conversion. she will NOT stop talking. and honestly? we love that for her. π£οΈπ
πΈ JSON COMMENTS πΈ
The Generic SQL backends have the 'comment' and 'disabled' fields in the 'records' table. The 'comment' field contains a comment for this record (if any) and the 'disabled' field tells PowerDNS if the record can be served to clients.
When a zonefile contains a comment like ; json={"comment": "Something", "disabled": true} and --json-comments is provided, the 'comment' field will contain "Something" and the 'disabled' field will be set to the database's native true value.
β οΈ WARNING: Using JSON comments to disable records means that the zone in PowerDNS is different from the one served by BIND, as BIND does not handle the disabled status in the comment.
so yeah. this one's a real warning, fr fr. BIND doesn't read that disabled status out of the comment, so PowerDNS and BIND will be serving different zones. she's not being dramatic, that's just what it is. π
π¦ SEE ALSO π¦
pdns_server(1)β her sister. go say hi. π
π AUTHOR π
PowerDNS.COM BV
π COPYRIGHT π
PowerDNS.COM BV
okay that's the whole page bestie!! PowerDNS Authoritative Server, dated Aug 05, 2026 β this manual page was served fresh on that date, so if you're reading it later, that's the vintage. π«Άβ¨
now go convert some zones, you absolute main character. ππ
π¦ where this page comes from
- alpine 3.24: pdns-doc 5.0.7-r0 Β· GPL-2.0-only WITH OpenSSL-Exception
- epel 10: pdns 5.0.7-1.el10_3 Β· GPL-2.0-only
- epel 9: pdns 5.0.7-1.el9 Β· GPL-2.0-only
- fedora 43: pdns 5.0.7-1.fc43 Β· GPL-2.0-only
- fedora 44: pdns 5.0.7-1.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms