[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Creating the database

Once permissions have been granted to the MP3 database you can use doodaha to build it. Doodaha is a program which can do a series of common SQL administration commands with one command. Building the database is one of the these commands. For more details on doodaha see 4. Using doodaha.

The doodaha command Build will build the database. It requires one argument which is the name of the database. If that database already exists it will drop (delete) it. Here is an example of using it.

 
> doodaha -v -u doodah -p build doodah
Building command list
Enter password: 
Executing commands
 Executing `Build doodah'

The -v flag makes doodaha verbose what is doing, the -u option sets the user to connect to the MySQL server with and the -p flag tells doodaha to request a password from you. At the prompt you will need to enter the password you created the new MySQL user with.

The build argument is the command you want doodaha to run. You can enter as many commands as you want on the one command line. It takes one argument (in this case `doodah') which is the name of the database to create.

If you get an error message like doodaha: connect failed: Access denied for user: 'doodah@localhost' (Using password: YES) then you haven't configured MySQL correctly. See section 3.1 Configuring MySQL.

If you want to check if the database has actually been built you can use the MySQL monitor to look at the database. eg:

 
 > mysql -u doodah -p doodah
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 141 to server version: 3.22.27

Type 'help' for help.

mysql> show tables;
+------------------+
| Tables in doodah |
+------------------+
| band             |
| cd               |
| list             |
| listitem         |
| mp3              |
+------------------+
5 rows in set (0.00 sec)

mysql> describe mp3;
+-----------+------------------+------+-----+---------+----------------+
| Field     | Type             | Null | Key | Default | Extra          |
+-----------+------------------+------+-----+---------+----------------+
| mp3_id    | int(10) unsigned |      | PRI | 0       | auto_increment |
| directory | varchar(100)     |      |     |         |                |
| filename  | varchar(100)     |      |     |         |                |
| band_id   | int(10) unsigned | YES  |     | NULL    |                |
| name      | varchar(100)     |      |     |         |                |
| cd_id     | int(10) unsigned | YES  |     | NULL    |                |
+-----------+------------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> quit;
Bye


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Neil Roberts on November, 8 2001 using texi2html