Specifications
2. Have access to MySQL on a machine that you do not administer such as a Web hosting
service, a machine at your workplace, and so on.
If this is the case, in order to work through the examples or to create your own database,
you’ll need to have your administrator set up a user and database for you to work with
and tell you the username, password, and database name they have assigned to you.
You can either skip the sections of this chapter that explain how to set up users and data-
bases or read them in order to better explain what you need to your system administrator.
As a normal user, you won’t be able to execute the commands to create users and data-
bases.
The examples in this chapter were all built and tested with MySQL version 3.22.27. Some ear-
lier versions of MySQL have less functionality. You should install or upgrade to the most cur-
rent stable release at the time of reading. You can download the current release from the
MySQL site at http://mysql.com.
A Note on Using the MySQL Monitor
You will notice that the MySQL examples in this chapter and the next end each command with
a semicolon (;). This tells MySQL to execute the command. If you leave off the semicolon,
nothing will happen. This is a common problem for new users.
This also means that you can have new lines in the middle of a command. We have used this to
make the examples easier to read. You will see where we have done this because MySQL pro-
vides a continuation symbol. It’s an arrow that looks like this:
mysql> grant select
->
This means MySQL is expecting more input. Until you type the semicolon, you will get these
characters each time you press Enter.
Another point to note is that SQL statements are not case sensitive, but database and table
names can be—more on this later.
How to Log In to MySQL
To do this, go to a command line interface on your machine and type the following:
> mysql -h hostname -u username -p
Your command prompt might look different depending on the operating system and shell you
are using.
Creating Your Web Database
C
HAPTER 8
8
CREATING YOUR
WEB DATABASE
185
11 7842 CH08 3/6/01 3:38 PM Page 185