In this lesson we will examine Client-Server Systems and the relationship between the Server and the Client programs that give us access to it. First, let's define a bit better what is the Server, and what are the Clients. The MySQL Server is a Command Line program named MySQLD, it is the only process in our database management system that directly touches and manipulates the tables in the database. The MySQL Server is a Single Process that runs in the background waiting to receive a request from a Client program. The Server is Multi-threaded, so each connection established by a Client is realized as a new thread in the RAM space occupied by the server program on its host machine. Using a Multi-threaded Server is more time efficient than setting up an entirely new process for every client connection. The MySQL Server was designed this way because of the environment in which it was intended to operate as an adjunct program to PHP for managing dynamically built websites. Since PHP was not able to maintain a persistent connection to the database in its early days, each user action on a website would require connecting to the server. So finding the most efficient way of reconnecting and retrieving data as quickly as possible was a major design priority, and what continues to make MySQL so popular in this environment today. MySQL Server also offers many choices of storage engine, which are assigned on a Table by Table basis. This allows different tables to be accessed in the way most appropriate to their use. Each storage engine offers additional features, some of which can be used to enhance or tune the performance of the table. There is an entire chapter devoted to an introduction to storage engines later in this course. The MySQL Server also offers many additional features for special purposes, we only skim the surface of such features in this course, but the course on MySQL 5 Administration goes into much more depth on that subject. There are many programs in the MySQL ecosystem that we call Client Programs, the basic purpose of a Client Program is to act as our intermediary with the MySQL Server that is we interact directly with the client and then the client communicates our request to the server. It then waits patiently for the server to act on our request returning any results to us. The client program then formats those results and displays them for us. The various client programs for MySQL are designed for different needs, in fact we can build our own client programs for specific tasks as well, but there are a number of clients that we install along with the server. In this course we will be using the very general interactive Command Line Client named mysql, spelled with all lowercase letters. We use this client for two basic reasons, one, it can transmit any command that the server can react to and two; it returns results to us in the rawest possible form that a human can still interpret easily. In this course, and the others in the series, we want to observe what commands can be successfully passed to the server along with their proper syntax and we want to see what results are returned from the server including any error messages if what we send doesn't follow the rules. Other clients tend to mask some of this from us, while this could be helpful in a workaday world, we will gain a deeper understanding of the system by using the MySQL Client, which will serve us well as we perform more complex tasks with MySQL. Finally the Client Programs and the Server with which they communicate can be running on the same host machine or they can be running on completely separate hosts located halfway around the world from each other. Depending on the operating system is involved, there are a number of communication protocols for us to choose from. For local access, that is where the Client and the Server are running on the same host, we have the most choice, although some choices are more suited to our needs than others depending upon the situation we find ourselves in. Here we see a schematic that represents this; the MySQLD Server is depicted here as having access to a database presumably held on some drive of the host computer. There are also two client processes running on the same host and connected to the server. If the host is running a Windows operating system the default Intra-process communication protocol is TCP/IP, but we could also choose from either Named Pipes or Shared Memory if a special need required one of them. On a Linux, Mac OS X or any other UNIX-based operating system, the default Intra-process communication protocol is a UNIX socket although TCP/IP is still available for special circumstances. But if we need to communicate with the MySQL Server from a remote host our only choice is TCP/IP. The operating systems on the Server Host and on the Client Host don't matter, we can mix them any way we like, but TCP/IP is the only protocol that we can use between processes running on separate machines. Here is a list of commonly used Command Line Clients that are installed along with the MySQL Server. We won't be exploring any of these in depth in this course except for the MySQL Interactive Client, but other courses in this series will have more to say about these and still other built-in clients. There are many other clients, many with Graphical User Interfaces, either from MySQL or third parties, in addition to the ones that we see here. MySQL offers its workbench product for example, and names like Toad and phpMyAdmin are familiar to MySQL users, and we can build our own applications using a variety of programming languages as well. But these would all just get in our way for our purposes here, so we'll save them for discussion at another time. Let's move on to discuss a few other database basics that we need to understand in order to use MySQL effectively.
| Course: | MySQL 5 Development (Part 1) |
| Author: | David Swain |
| SKU: | 34225 |
| ISBN: | 1-936334-93-3 |
| Release Date: | 2011-05-27 |
| Duration: | 11 hrs / 129 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |