Specifications
Using MySQL
P
ART II
184
In this chapter we’ll talk about how to set up a MySQL database for use on a Web site.
We’ll cover
• Creating a database
• Users and privileges
• Introduction to the privilege system
• Creating database tables
• Column types in MySQL
In this chapter, we’ll 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 you’ve done all those things, you can go right ahead and read this chapter. If you
haven’t, 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