Node:Preparing the database, Next:, Previous:Building the source, Up:Installation



Preparing the database

Now that you have installed MyDNS, you'll need to set up a database and access permissions. First, create a database called mydns on your database server:

     MySQL:
     $ mysqladmin -h host -u username -p create mydns
     
     PostgreSQL:
     $ createdb mydns
     

Next, create the tables in your database that will hold the DNS data. The mydns program has an option that will dump an appropriate set of CREATE TABLE statements to the standard output, which you may then examine and use to create the MyDNS tables.

     MySQL:
     $ mydns --create-tables | mysql -h host -u username -p mydns
     
     PostgreSQL:
     $ mydns --create-tables | psql mydns
     

When you have created the tables, you should have three tables in your mydns database, called soa (see soa table), rr (see rr table), and ptr (see ptr table).

(You can use the mydnsimport program to import zone data from non-MyDNS servers. See mydnsimport.)

Next, create a user that the mydns server can use to access the mydns database:

     MySQL:
     $ mysql -h host -u username -p mydns
     mysql> GRANT SELECT ON mydns.* TO user@localhost
            IDENTIFIED BY 'password';
     
     PostgreSQL:
     $ psql mydns
     mydns=# CREATE USER user WITH PASSWORD 'password';
     mydns=# GRANT SELECT ON soa,soa_id_seq TO user;
     mydns=# GRANT SELECT ON rr,rr_id_seq TO user;
     mydns=# GRANT SELECT ON ptr,ptr_id_seq TO user;