Database Reference
In-Depth Information
puted by others. We will not go into this argument here, but if someone points this out to
you, do not be too concerned. Let these debates continue, and just use the software!
Client-server Systems
We have already described how MySQL is a database management system, in that it controls
access to the database as well as how the database is physically ordered on the storage
medium. You probably are very familiar with the concept of a client-server system.
Figure 1.3 shows a simple diagram of one of these. Data is stored on the server, and when
the client needs to access that data, it makes a request to the server. On receiving that
request, the server takes the necessary action, and sends its response back to the client. The
response could be the data, a request for more details, or an error message. One of the most
widespread client-server systems is the internet. A remote client, often in another country
from the server, makes a request for some form of data over the internet, which the server
responds to.
The client and the server do not necessarily have to be on different machines. As you set
up MySQL in the course of reading this topic, you will set up the MySQL server software
and the client software on the same machine. The system is still a client-server system even
if it all runs in the same box.
One of the commonest uses of MySQL is as a database behind a website. When it is used
in this way there are lots of client-server requests happening. Figure 1.4 illustrates this.
In Figure 1.4 you can see that first of all a user asks a web browser to look at a webpage.
This request gets sent to the webserver. If that webpage is built using a scripting language
such as PHP, the request gets forwarded to the script processor. If the script processor finds
database commands (SQL) in the script it passes them to the DBMS, that is, the MySQL
server. MySQL processes the SQL, which is sent back to the script processor as text. This
text is used to generate the HTML along with other commands in the scripting language,
and this gets sent back to the user in HTML, which finally gets processed by the web
browser into a webpage. Although this seems like a complex route, it can happen very
quickly, even when the servers are on different machines that the requests and responses
have to be forwarded between. Each server is specifically optimized to do its own task
quickly, so they all work well together.
Client
Request
Server
Response
Figure 1.3
Client-server system.
 
Search WWH ::




Custom Search