PowerDNS export from MySQL to csv using command line

PowerDNS uses the MariaDB database. Data can be exported from the database using the command line. There are two options to do it: 1. run commands on the mysql command line or 2. mysqldump.

Image without description

Let's start, set a directory for csv-file

sudo mkdir /tmp/mysql
sudo chown -R mysql:mysql /tmp/mysql/

This eliminates an error message such as "ERROR 1 (HY000): Can't create/write to file '/home/exsample_domainparkki_com.csv' (Errcode: 13 "Permission denied")"

1. Run the following command on the mysql command line

SELECT * FROM domains
INTO OUTFILE '/tmp/mysql/exsample_domainparkki_com.csv'

2. Using mysqldump

mysqldump -u [username] -p -t -T/path/to/directory [database] [tableName] --fields-terminated-by=,

The csv file can be imported into Airtable/Baserow for further processing, for example.

Noteworthy deal

Domainparkki may be able to help if you need plain name server services for hobby/low volume use. Only 5 euros +VAT per zone per year. One zone = one domain, including 20 records per zone and 1 billion queries per month (excess traffic is billed separately). Open the link above and check it out. Inquiries by email hello@domainparkki.com.

// viHannes, 8 Feb 2022 in Helsinki, Finland