Chapter 7. Working with MySQL
It’s time to learn how to connect to the MySQL database using the client tools that come with MySQL. You may also use a web-based tool called phpMyAdmin to modify your database. We’ll also cover how to use SQL to create databases, users, and tables, as well as how to modify existing objects in the database.
MySQL has its own client interface, allowing you to move data around and change database configuration. Note that you should use a password to log in. Assigning database users allows you to limit access to tables based on the logged-in database user. Each MySQL server can host many databases. A web application may use its own proprietary database or a standard database like MySQL.
You may have installed MySQL yourself or have access to it through your ISP. Most ISPs that support PHP also provide a MySQL database for your use. Should you have difficulty, check their support pages or contact them to determine connection details. You’ll need to know the following:
The IP address of the database server
The name of the database
If you’ve installed MySQL on your computer, you’ll be able to use the defaults from the installation and the password you specified. This chapter looks at two ways to communicate with MySQL: the command line and phpMyAdmin.
Accessing the Database from the Command Line
One way of communicating with MySQL is through the MySQL command-line client. Depending on which operating system you’re using, you ...