This directory contains SQL schema files for initializing PowerAdmin with different database backends.
Important: PowerDNS database schema must be installed BEFORE setting up PowerAdmin. PowerAdmin extends the PowerDNS database with additional tables for its management interface.
- Install PowerDNS schema first (see PowerDNS Schema Files section below)
- Install PowerAdmin schema on top of the existing PowerDNS database
- Create an admin user for PowerAdmin
The pdns/ directory contains PowerDNS schema files for different versions:
pdns/45/- PowerDNS 4.5.x schemaspdns/46/- PowerDNS 4.6.x schemaspdns/47/- PowerDNS 4.7.x schemaspdns/48/- PowerDNS 4.8.x schemaspdns/49/- PowerDNS 4.9.x schemas
Each version directory contains:
schema.mysql.sql- MySQL/MariaDB schemaschema.pgsql.sql- PostgreSQL schemaschema.sqlite3.sql- SQLite schema
Choose the schema files that match your PowerDNS version.
poweradmin-mysql-db-structure.sql- MySQL/MariaDB schemapoweradmin-pgsql-db-structure.sql- PostgreSQL schemapoweradmin-sqlite-db-structure.sql- SQLite schema
The database schemas no longer include a default admin user for security reasons. You need to create an admin user manually using SQL commands.
To create an admin user, use these SQL commands:
-- Generate password hash using PHP CLI first:
-- php -r "echo password_hash('your-password', PASSWORD_DEFAULT);"
INSERT INTO users (username, password, fullname, email, description, perm_templ, active, use_ldap)
VALUES (
'admin',
'$2y$10$...', -- Replace with generated hash
'Administrator',
'admin@example.com',
'Administrator with full rights.',
1, -- Administrator permission template
1, -- Active
0 -- Not using LDAP
);-- Generate password hash using PHP CLI first:
-- php -r "echo password_hash('your-password', PASSWORD_DEFAULT);"
INSERT INTO users (username, password, fullname, email, description, perm_templ, active, use_ldap)
VALUES (
'admin',
'$2y$10$...', -- Replace with generated hash
'Administrator',
'admin@example.com',
'Administrator with full rights.',
1, -- Administrator permission template
1, -- Active
0 -- Not using LDAP
);-- Generate password hash using PHP CLI first:
-- php -r "echo password_hash('your-password', PASSWORD_DEFAULT);"
INSERT INTO users (username, password, fullname, email, description, perm_templ, active, use_ldap)
VALUES (
'admin',
'$2y$10$...', -- Replace with generated hash
'Administrator',
'admin@example.com',
'Administrator with full rights.',
1, -- Administrator permission template
1, -- Active
0 -- Not using LDAP
);Create a PHP script to generate the password hash:
<?php
// generate-admin-hash.php
$password = 'your-secure-password'; // Change this!
$hash = password_hash($password, PASSWORD_DEFAULT);
echo "Password hash: $hash\n";
echo "Use this hash in the SQL INSERT statement above.\n";
?>- Never use default passwords in production environments
- Always generate strong passwords for admin accounts
- Change passwords immediately after first login
- Use environment variables or secrets to manage passwords in automated deployments
- Enable two-factor authentication if available
The perm_templ field references permission templates:
1- Administrator (full access)- Other templates can be configured through the PowerAdmin interface
Update scripts are provided for migrating between PowerAdmin versions:
poweradmin-*-update-to-*.sql- Version-specific update scripts