Topic: Create Databases Needed by Kete

Topic type:

The steps necessary for creating databases supporting an installation of Kete.

Originally written by Walter McGinnis, Kete Project Lead for Katipo Communications, Ltd.

Part of the Installation Guide

MySQL instructions

Important Note: This step assumes that you are logged in as the user who will be running your Kete. For demos and development this is likely your normal account, for production this is the "kete" account if you have followed the conventions laid forth in the last step. You'll also need your MySQL root user's password to do this step.

Set up databases

We need to set up our databases for use with our new application. This is pretty simple, but does require some simple editing of a file and running some MySQL stuff. Here goes:

$ cd ~/apps/your_app/
$ cp config/database.example config/database.yml

Open config/database.yml in your text editor. Edit username and password settings to suit. You'll also want to change occurances of "kete_" to "your_app_", for example "kete_development" becomes "your_app_development".

After saving config/database.yml, you want to open a mysql session and create your databases and grant rights on them to whatever you chose for username in the file:

$ mysql -u root -p mysql # enter the mysql root password
...
mysql> create database your_app_production;
mysql> grant all on your_app_production.* to 'the_username_you_chose'@'localhost' identified by 'the_password_you_chose';
mysql> create database your_app_development;
mysql> grant all on your_app_development.* to 'the_username_you_chose'@'localhost';
mysql> create database your_app_test;
mysql> grant all on your_app_test.* to 'the_username_you_chose'@'localhost';
mysql> quit;

PostgreSQL instructions

Create Postgres user

This will need to be done as your database super-user, or a user empowered to create roles.

$ createuser kete
Should this user be a super-user? - NO
Should this user be allowed to create databases? - YES
Should this user be allowed to create more users? - NO

Refer to the PostgreSQL manual for further information if you need to configure a password or remote access; otherwise, if you are using a local database and unix authentication, no further setup is necessary.

The database will actually be created later by the deployment stage. 

Configure database

Follow the instructions above for MySQL to get a new config/database.yml, and edit accordingly. Set the "adapter" to "postgresql" for each environment.



Next step:
Configure Backgroundrb

Discuss This Topic

There are 5 comments in this discussion.

Read and join this discussion

join this discussion

Creative Commons Attribution-Share Alike 3.0 New Zealand License
Create Databases Needed by Kete by Walter McGinnis is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License