Training Platform External Databases Maintenance
Overview
The goal of this topic is to train you in the maintenance tasks of the external databases used on xAPPnow. The main tasks are:
-
Create database
-
Remove database
-
Create user
-
Modify user password
-
Set user owner of tables in database
-
Set user GRANT privileges on database
Exercise 1: Database Administration Tasks
-
Step 1: Create database
./appollo-create-database.sh <DB_CONTAINER> <DB_NAME>
Example:
./appollo-create-database.sh stacktest_dbhost_1 DBTutorial
Parameter Explanation:
-
CONTAINER_NAME is the name of the database container.
-
DB_NAME is the name of the database to create
-
Step 2: Remove database
./appollo-remove-database.sh <DB_CONTAINER> <DB_NAME>
Example:
./appollo-create-user.sh stacktest_dbhost_1 DBTutorial
-
Step 3: Create user
./appollo-create-user.sh <DB_CONTAINER> <USER> <PASSWORD>
Parameter Explanation:
-
PASSWORD is the new user password
-
USER is the username
It’s recommended to not write the password in clear text in the command as it is saved in the console history and may be get by a malicious user. To avoid this, it can be saved in a variable from a file, as example:
PASSWORD=$(cat <PASSWORDFILE>)
./appollo-create-user.sh stacktest_dbhost_1 tutorial $PASSWORD
-
Step 4: Modify user password
./appollo-modify-user.sh <DB_CONTAINER> <USER> <PASSWORD>
Example:
PASSWORD=$(cat <PASSWORDFILE>)
./appollo-modify-user.sh stacktest_dbhost_1 tutorial $PASSWORD
-
Step 5: Set user owner of tables in database
./appollo-modify-database-owner.sh <DB_CONTAINER> <DB_NAME> <SCHEMA> <USER>
Example:
./appollo-create-database.sh stacktest DB_Tutorial
-
Step 6: Set user GRANT privileges on database
./appollo-grant-privileges-on-schema.sh <DB_CONTAINER> <DB_NAME> <SCHEMA> <USER>
Example:
./appollo-grant-privileges-on-schema.sh stacktest_dbhost_1 DBTutorial public tutorial
