Database Reference
In-Depth Information
To try for yourself the examples shown in this topic, you need a MySQL user account
and a database. The first two recipes in this chapter describe how to use mysql to set
those up, based on these assumptions:
• The MySQL server is running locally on your own system
• Your MySQL username and password are cbuser and cbpass
• Your database is named cookbook
If you like, you can violate any of the assumptions. Your server need not be running
locally, and you need not use the username, password, or database name that are used
in this topic. Naturally, in such cases, you must modify the examples accordingly.
Even if you choose not to use cookbook as your database name, I recommend that you
use a database dedicated to the examples shown here, not one that you also use for other
purposes. Otherwise, the names of existing tables may conflict with those used in the
examples, and you'll have to make modifications that would be unnecessary with a
dedicated database.
Scripts that create the tables used in this chapter are located in the tables directory of
the recipes distribution that accompanies MySQL Cookbook . Other scripts are located
in the mysql directory. To get the recipes distribution, see the Preface .
Alternatives to the mysql Program
The mysql client is not the only program you can use for executing queries. For example,
you might prefer the graphical MySQL Workbench program, which provides a point-
and-click interface to MySQL servers. Another popular interface is phpMyAdmin,
which enables you to access MySQL through your web browser. If you execute queries
other than by using mysql , some concepts covered in this chapter may not apply.
1.1. Setting Up a MySQL User Account
Problem
You need an account for connecting to your MySQL server.
Solution
Use CREATE USER and GRANT statements to set up the account. Then use the account
name and password to make connections to the server.
 
Search WWH ::




Custom Search