Skip to content
Byrne Reese edited this page May 13, 2011 · 1 revision

Setting Up a Database for Melody

Melody requires that users setup a database into which all of its data will be stored. It is advised to set this database up prior to beginning the Melody Setup Wizard that is triggered the first time you access Melody. This document will help you setup and create your database using one of a number of different options.

This document is specific to setting up MySQL, which is the predominant database used by most Melody users.

What You Will Need

  • Access to a MySQL Server.
  • Administrative rights to that MySQL Server.

Installing a MySQL Server

It is presumed that you have access to, or have installed locally a copy of MySQL, and its client libraries. If you need help installing MySQL on your machine, or on another server, it is recommended you go to MySQL's web site and consult their documentation on installing MySQL. Most ISPs however should be able to set this up for you, or provide you with the credentials you need to access MySQL.

When consulting the internet for guides to help you, search specifically for "how to install mysql on ." Chances are someone out there has created an installation bundle for you that will make installation a breeze. This is certainly the case for most linux distributions (via yum or apt-get), Mac (via macports), and Windows (via .exe binaries or our favorite: XAMPP).

Creating the Database via...

Once you have access to a MySQL server, you need to create the database for Melody. You can do that using the following techniques.

Command Line

Those comfortable working with the command line will find the process of setting up a database to be trivial. Even if you are not that comfortable working with a command line, you might be surprised how quickly you can get up and running.

Ok, so first, open up a terminal or a "command prompt." Then enter in the following command:

prompt> mysqladmin -h <HOST> -u <USERNAME> -p create melody

Substitute for the server/domain your server is installed on. For many people this is often just 'localhost'. Substitute for the administrator's username that has been granted permission to create databases on the server. When you run the command, you should be prompted by the system to enter in a password. Enter in a password and you are done. If the system experiences a problem or encounters an error, it will be displayed on the screen. For example, to create a database on the server living at somedomain.com using the 'admin' user, run the following command:

prompt> mysqladmin -h somedomain.com -u admin -p create melody

These same values can then be input into the Melody Setup Wizard or directly into Melody's config.cgi file like so:

Database melody
DBUser admin
DBHost somedomain.com
DBPassword xxxxxxxx

Locking Down Your Database

If you are concerned about security, which you should be for any system that lives out there on the public internet, then you should consider creating a user in your database devoted to Melody which has access only to your melody database. If you are lazy for example and use your administrator's username and password, and your server is compromised, then the intruder will have access to EVERYTHING just by looking at your config.cgi file. Yikes. By creating a dedicated user, then the worst that can happen (and granted this is still pretty bad) is that only your Melody database will be compromised.

To create a dedicated user, run the following commands at your terminal and MySQL prompts:

prompt> mysql -u <ADMIN USER> -p mysql
mysql> INSERT INTO user VALUES ('localhost','<MELODY USER NAME>',PASSWORD('<somepassword>'),
       'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
mysql> INSERT INTO db VALUES ('%','<MELODY DB NAME>','<MELODY USER NAME>',
       'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
mysql> exit;
prompt> mysqladmin reload -u <ADMIN USER> -p
Clone this wiki locally