Databases Reference
In-Depth Information
CHAPTER 3
Using the MySQL Monitor
MySQL has a client-server architecture ; clients connect to the server to perform database
operations such as reading or storing data. There are many MySQL clients available,
including some that have graphical interfaces. You can also develop your own clients.
The standard MySQL command-line client or “monitor” program provided by MySQL
AB is the client you'll probably use the most often. The monitor allows you to control
almost all aspects of database creation and maintenance using SQL and the custom
MySQL extensions to SQL.
In this chapter, we'll examine how to start the monitor and how to run commands
through the monitor either interactively or in batch mode. We'll describe how you can
access the inbuilt MySQL help functions, and how to test your MySQL setup using the
sample databases from the topic web site. We'll also take a quick look at a couple of
graphical tools that you can use instead of the monitor.
Starting the Monitor
The monitor program is called simply mysql and is found in a directory with the other
MySQL programs. The exact location depends on your operating system and how you
chose to install MySQL; we considered some of these in “Error Message About MySQL
Executable Programs Not Being Found or Recognized,” in Chapter 2.
If your MySQL server isn't already running, start it using the appropriate procedure for
your setup as discussed in Chapter 2. Now, follow these steps to start the monitor and
connect to your MySQL server as the MySQL administrator (the MySQL root user) by
typing this from the command line:
$ mysql --user=root
If you followed our instructions in Chapter 2, the MySQL root account is protected by
the password you chose earlier, and so you'll get a message saying that you've been
denied access to the server. If your server has a password, you should specify the pass-
word as follows:
$ mysql --user=root --password= the_mysql_root_password
 
Search WWH ::




Custom Search