Specifications

Using MySQL
P
ART II
184
In this chapter well talk about how to set up a MySQL database for use on a Web site.
Well cover
Creating a database
Users and privileges
Introduction to the privilege system
Creating database tables
Column types in MySQL
In this chapter, well follow through with the Book-O-Rama online bookstore application dis-
cussed in the last chapter. As a reminder, here is the schema for the Book-O-Rama application:
Customers(CustomerID, Name, Address, City)
Orders(OrderID, CustomerID, Amount, Date)
Books(ISBN, Author, Title, Price)
Order_Items(OrderID, ISBN, Quantity)
Book_Reviews(ISBN, Reviews)
Remember that primary keys are underlined and foreign keys have a dotted underline.
In order to use the material in this section, you must have access to MySQL. This usually
means that you
1. Have completed the basic install of MySQL on your Web server. This includes
Installing the files
Setting up a user for MySQL to run as
Setting up your path
Running mysql_install_db, if required
Setting the root password
Deleting the anonymous user
Starting the MySQL server and setting it up to run automatically
If youve done all those things, you can go right ahead and read this chapter. If you
havent, you can find instructions on how to do these things in Appendix A, Installing
PHP 4 and MySQL.
If you have problems at any point in this chapter, it might be because your MySQL sys-
tem is not set up correctly. If that happens, refer back to this list and Appendix A to make
sure that your set up is correct.
11 7842 CH08 3/6/01 3:38 PM Page 184