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-conf parameter. so like, pick one, you cannot have both, it's giving "choose your fighter". βš”οΈ
  • --zone-name=<NAME> β€” When parsing a single zone without $ORIGIN statement, set ZONE as the zone name. basically: if there's no $ORIGIN telling 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 in named.conf as 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 πŸ¦‹


πŸ’œ AUTHOR πŸ’œ

PowerDNS.COM BV


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