2022-12-09 01:44:52 +00:00
# Setup MySQL database for PowerDNS-Admin
2022-12-08 15:52:02 +00:00
This guide will show you how to prepare a MySQL or MariaDB database for PowerDNS-Admin.
2022-12-13 02:49:51 +00:00
We assume the database is installed per your platform's directions (apt, yum, etc). Directions to do this can be found below:
2022-12-13 02:41:41 +00:00
- MariaDB:
- https://mariadb.com/kb/en/getting-installing-and-upgrading-mariadb/
- https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-ubuntu-20-04
- MySQL:
- https://dev.mysql.com/downloads/mysql/
- https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
2022-12-13 02:49:51 +00:00
The following directions assume a default configuration and for productions setups `mysql_secure_installation` has been run.
2022-12-09 02:50:25 +00:00
2022-12-09 01:56:16 +00:00
## Setup database:
2022-12-09 02:50:25 +00:00
2022-12-13 02:41:41 +00:00
Connect to the database (Usually using `mysql -u root -p` if a password has been set on the root database user or `sudo mysql` if not), then enter the following:
2022-12-09 02:50:25 +00:00
```
CREATE DATABASE `powerdnsadmin` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON `powerdnsadmin` .* TO 'pdnsadminuser'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
FLUSH PRIVILEGES;
```
2022-12-09 03:04:23 +00:00
- If your database server is located on a different machine then change 'localhost' to '%'
- Replace YOUR_PASSWORD_HERE with a secure password.
2022-12-08 15:52:02 +00:00
2022-12-13 02:41:41 +00:00
Once there are no errors you can type `quit` in the mysql shell to exit from it.
2022-12-09 11:02:26 +00:00
## Install required packages:
### Red-hat based systems:
2022-12-09 14:56:08 +00:00
```
yum install MariaDB-shared mariadb-devel mysql-community-devel
```
2022-12-09 11:02:26 +00:00
### Debian based systems:
```
apt install libmysqlclient-dev
```
### Install python packages:
```
pip3 install mysqlclient==2.0.1
```
2022-12-09 01:54:18 +00:00
## Known issues:
2022-12-08 15:52:02 +00:00
2022-12-09 02:50:25 +00:00
Problem: If you plan to manage large zones, you may encounter some issues while applying changes. This is due to PowerDNS-Admin trying to insert the entire modified zone into the column history.detail.
2022-12-08 15:52:02 +00:00
Using MySQL/MariaDB, this column is created by default as TEXT and thus limited to 65,535 characters.
2022-12-09 02:50:25 +00:00
Solution: Convert the column to MEDIUMTEXT:
2022-12-13 02:41:41 +00:00
1. Connect to the database shell as described in the setup database section:
2. Execute the following commands:
```
USE powerdnsadmin;
ALTER TABLE history MODIFY detail MEDIUMTEXT;
```