Introduction to MySQL Server
There are many RDBMS (systems) that are available in the market for managing the databases, the most popular among them is MySQL. MySQL is an open-source Relational Database Management System(RDBMS) and it is based on Structured Query Language (SQL – which is a language to manage the DataBase and perform CRUD operations such as create, read, update and delete.). here we discuss the MySQL Server.
MySQL, A Brief Journey
- It was first created and owned by a Swedish company named MySQL AB with its first initial release in the year 1995, May 23.
- In 2008, MySQL AB was acquired by Sun Microsystems in a 1 billion deal.
- In 2010, Sun Microsystems was further acquired by Oracle.
- The latest version of the MySQL server is 8.0 which was released on April 19, 2018.
It can virtually run on any platform such as Linux, Solaris, and windows and it is the most popular and most widely RDBMS because it is an open source and freeware DB Server which provides much-advanced database functionalities.
- Google, Facebook, Yahoo, and lots of other Tech giants have employed MySQL to enhance their data processing capabilities.
- MySQL is a very important component for LAMP which is a web development platform with Linux as the operating system, Apache as the web server, MySQL as RDBMS, and PHP as a programming language. Nevertheless, Python or Perl can be used as well instead of PHP as the programming or scripting language.
- It can be used everywhere, where the Data needs to be stored in a relational manner i.e. in a tabular format. Every table has a primary key and rows can relate to each other using this primary key.
The advantages are as follows.
- Portable: It can run on a huge number of platforms like UNIX, Solaris, Windows, OS/2, etc.
- Open Source: Most importantly, MySQL is made available to all as open-source software and anyone can use it free of cost by agreeing to its terms and conditions.
- Security: All MySQL Data Bases are very secure and are locked with passwords that are encrypted using complex algorithms and it’s never easy to breach them.
- Connectivity: There are a good number of mechanisms available to connect with MySQL servers such as TCP/IP, UNIX Sockets, and named pipes.
- Regular Updates and Continuous Development: Being an open-source platform, MySQL has a huge developer community and they release patches and updates for MySQL regularly.
Architecture Of MySQL Server
The architecture of MySQL mainly consists of the following components:
- MySQL Server
- MySQL Clients
- Data Directory
- Storage Engine
MySQL is based on a Client-Server Model.
It is a MySQL instance where the actual data is getting stored and processed. This component is responsible for processing the incoming queries coming from MySQL clients and manipulates the database tables. It is also responsible for accepting database connections that are coming from MySQL Clients. Important Programs of MySQL Server component are:
- MySQL: It is a MySQL server daemon program. It runs in the background and manages requests from MySQL clients.
- mysqld_safe: It is a program that restarts the server whenever an error occurs. This was one safety feature of this program, the other one is that it maintains the logs for the runtime information to an error log.
- mysql.server: It is a MySQL utility that has been provided to start the mysqld_safe script.
- mysqld_multi: This program is used to manage many mysqld processes that listen for connections on different connections channels like TCP/IP, UNIX Sockets, etc.
The MySQL clients are basically the utilities used for communicating with the MySQL server. In other words, these are the programs that communicate with the MySQL server. Examples of MySQL clients are any programs like Perl, PHP, Java, MySQL, mysqladmin and tools such as MySQL dump, mysqlcheck, myisamchk. Important programs under MySQL clients are:
- MySQL is an SQL shell where one can write and execute SQL statements. It can be interactive or non-interactive. When used interactively, results are returned in a tabular format while non-interactive usage returns the result in a tab-separated format.
- mysqladmin is a client for administrating MySQL server. It can be used to check configurations files, update them, to check for the current status of the server, and also to create and drop the databases, etc.
- mysqldump is a client utility and a database backup program that performs logical backups.
- mysqlcheck and myisamchk are clients that are used to perform maintenance on Database tables like repairing, optimizing, and analyzing of the tables.
The Data Directory contains the actual data that is being stored as a result of ongoing operations over any applications/software or servers. It includes Databases, tables, log files, stored procedures, etc.
- The default location for datadir in Linux is: /var/lib/mysql
- The default location for datadir in Windows is :C:\ProgramData\MySQL\MySQL Server 5.8
- The name of the configuration file which contains the path for datadir is mysqld.cnf
- cnf can be found at /etc/mysql/mysql.conf.d/mysqld.cnf
- It is indeed possible to change the storage location for datadir in case someone runs out of allocated space. Please go through the below article which explains beautifully how it can be achieved:
A storage Engine is a software module that is being used by RDBMS to perform CRUD operations (Create, read, update and delete).
The storage engines are of two types in MySQL:
The main difference between the Transactional and Non Transactional storage engine is that the transactional tables will record all the database operations in a log file so even if MySQL crashes, you can still get your data back while this is not the case with Non-Transactional Engines. Nevertheless, to point out, non-transactional engines are much faster and they also have lower disk space requirements. Below are some of the Storage Engines that is being used by MySQL, the most widely used among them is the InnoDB.
MySQL supported storage engines:
This has been a guide to the MySQL Server. Here we have studied the basic concepts, examples, advantages, and Architecture of MySQL Server in detail. You may also look at the following articles to learn more –