Create a MySQL DocDB Database

  1. Start by creating a test database to make sure you can work with MySQL.
  2. Create the DocDB database and accounts:
    mysql -u root -p
    mysql> show databases;
    mysql> use mysql;
    mysql> select * from user;
    mysql> delete from user where user="";
    mysql> create database SomeDocDB;
    mysql> grant select on SomeDocDB.* to docdbro@localhost identified by "read only password";
    mysql> grant select on SomeDocDB.* to docdbro@mydocs.fnal.gov identified by "read only password";
    mysql> grant select,insert,update,delete on SomeDocDB.* to docdbrw@mydocs.fnal.gov identified by "read write password";
    mysql> grant select,insert,update,delete on SomeDocDB.* to docdbrw@localhost identified by "read write password";
    mysql> grant ALL on SomeDocDB.* to docdbadm@localhost identified by "database owner password";
    mysql> grant ALL on SomeDocDB.* to docdbadm@mydocs.fnal.gov identified by "database owner password";
    mysql> quit
    
  3. MySQL accounts. You may choose your own names or leave these as defaults. Only docdbadm (in our example) is visible to users, but if you have more than one DocDB sharing the same MySQL server, you may want different names.
  4. Definition of MySQL access restrictions:
  5. Test access: Login to the host where DocDB will run and as the user (usually the user that runs Apache) that the scripts will run under. Connect to DocDB with mysql -h hostname -u docdbro -p SomeDocDB. Make sure you can connect. If not, see if you are running SELinux extensions. There are reports of these access rules being configured to disallow access from the Apache user to MySQL
  6. Create the DocDB tables:
    mysql -u docdbadm -p SomeDocDB < CreateDatabase.SQL
    (CreateDatabase.SQL is in DocDB/sql)
  7. You will need to declare the database administrator in the SecurityGroup table.
    mysql -u docdbadm -p SomeDocDB
    mysql> insert into SecurityGroup set Name='docdbadm',Description='DocDB Administrators',CanCreate=1,CanAdminister=1;
    
  8. Populating the database
  9. The web interface allows the database administrator to perform administrative tasks, such as adding Major and Minor Topics. Access to the administrative links is restricted to database administrators. You will not see the links unless you use the database administrator username to login to the database pages.
  10. Authors can be added by anyone in a trusted group.
  11. All relevant tables will be populated from the web interface when a document is entered into the database.

DocDB License


Document Database