MariaDB
sudo apt install mariadb-server
我们需要给ROOT用户设置一个初始密码。
方法1:
mysql -u root
use mysql;
update user set password=password("root")where user='root';
flush privileges;
exit;
方法2:用mysqladmin
格式:mysqladmin -u用户名 -p旧密码 password 新密码
例子:
mysqladmin -uroot -p1234567 password admini
测试:
service start mysql
mysql -u root -p
mysql
表结构文件和外键修改文件wget -c https://raw.githubusercontent.com/PowerDNS/pdns/rel/auth-4.1.x/modules/gmysqlbackend/schema.mysql.sql
wget -c https://raw.githubusercontent.com/PowerDNS/pdns/rel/auth-4.1.x/modules/gmysqlbackend/enable-foreign-keys.mysql.sql
MariaDB
执行,创建用户,数据库和表 ~$ sudo mysql -u root -p
MariaDB [(none)]> CREATE USER 'pdns'@'localhost' IDENTIFIED BY 'pdns';
MariaDB [(none)]> CREATE DATABASE powerdns;
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'pdns'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
~$ sudo mysql -u pdns -p
MariaDB [(none)]> use powerdns;
MariaDB [powerdns]> source ~/schema.mysql.sql
MariaDB [powerdns]> source ~/enable-foreign-keys.mysql.sql
MariaDB [powerdns]> exit
PowerDNS
~$ sudo apt install pdns-server pdns-backend-mysql pdns-backend-lua pdns-tools
~$ sudo vim /etc/powerdns/pdns.d/gmysql.conf
launch+=gmysql
gmysql-host=127.0.0.1
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=pdns
gmysql-password=pdns
gmysql-dnssec=no
gmysql-innodb-read-committed=yes
gmysql-timeout=10
~$ sudo vim /etc/powerdns/pdns.conf
local-address=本机IP
# 开机启动pdns服务
~$ sudo systemctl enable pdns
~$ sudo systemctl start pdns
recursor.conf
:webserver=yes
api-key=changeme
并重新启动pdns_recursor
,以下示例应该开始工作:
sudo systemctl restart pdns
curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/api/v1/servers/localhost | jq .
curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq .