Specifications

If it isnt your machine, make sure that you typed in the password correctly.
You should now be at a MySQL command prompt, ready to create the database.
If you are using your own machine, follow the guidelines in the next section.
If you are using somebody elses machine, this should already have been done for you. You
can jump ahead to the Using the Right Database section. You might want to read the inter-
vening sections for general background, but you wont be able to run the commands specified
there. (Or at least you shouldnt be able to!)
Creating Databases and Users
The MySQL database system can support many different databases. You will generally have
one database per application. In our Book-o-Rama example, the database will be called
books.
Creating the Database
This is the easiest part. At the MySQL command prompt, type
mysql> create database dbname;
You should substitute the name of the database you want to create for dbname. To begin creat-
ing the Book-O-Rama example, you can create a database called books.
Thats it. You should see a response like
Query OK, 1 row affected (0.06 sec)
This means everything has worked. If you dont get this response, make sure that you typed
the semicolon at the end of the line. A semicolon tells MySQL that you are finished, and it
should actually execute the command.
Users and Privileges
A MySQL system can have many users. The root user should generally be used for administra-
tion purposes only, for security reasons. For each user who needs to use the system, you will
need to set up an account and password. These do not need to be the same as usernames and
passwords outside of MySQL (for example, UNIX or NT usernames and passwords). The
same principle applies to root. It is a good idea to have different passwords for the system and
for MySQL, especially when it comes to the root password.
It isnt compulsory to set up passwords for users, but we strongly recommend that you set up
passwords for all the users that you create.
Creating Your Web Database
C
HAPTER 8
8
CREATING YOUR
WEB DATABASE
187
11 7842 CH08 3/6/01 3:38 PM Page 187