Skip to content

Database Installation

Dmitry Romanov edited this page Mar 14, 2017 · 9 revisions

Prerequisites

In order to do the steps below one has to set environment variables as it is described in RCDB installation section. RCDB_CONNECTION should be set also (see below).

Lets assume that one wants to install RCDB to the following database:

  • database location: localhost
  • database name: rcdb
  • database user name: rcdb
  • database user password: password

then the connection string should be

mysql://rcdb:password@localhost/rcdb

and

export RCDB_CONNECTION='mysql://rcdb:password@localhost/rcdb'

Create MySQL database

(RCDB is tested for MySQL and MariaDB. Also RCDB should work with other MySQL forks while it hasn't been tested)

  1. Create DB(aka schema) and a user with privileges:

    mysql -u root -p

    note that by default for MariaDB one have to be root to login mysql as root. So it is something like sudo mysql -u root -p for MariaDB

    CREATE SCHEMA rcdb;
    CREATE USER 'rcdb'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON rcdb.* TO 'rcdb'@'localhost';
  2. Create database structure:

    python $RCDB_HOME/python/create_empty_db.py -c mysql://rcdb:password@localhost/rcdb

    The script will make you to add --i-am-sure flag

Update database to the latest version

RCDB uses Alembic to track and update database version. After creating db scheme one has to run alembic to upgrade DB to the latest version:

cd $RCDB_HOME
alembic upgrade head

After this the database is of the latest version and is ready to be used