MySQL in the LAMP Stack

What MySQL Is and Where It Sits in the LAMP Stack

MySQL 524 is a relational database server: a program, mysqld, that owns a data directory and answers SQL from clients. Unlike SQLite 4,756 it is not a library your code loads. PHP, the mysql command line and Workbench 524 are all clients that connect, authenticate as an account, send statements and read result sets, so one server can serve a hundred PHP-FPM workers.

Where MySQL sits in a LAMP request, and the two ways a client reaches it
Where MySQL sits in a LAMP request, and the two ways a client reaches it

Inside mysqld each connection gets a thread. The SQL layer parses a statement, the optimizer chooses a plan (Optimizer and EXPLAIN), and a storage engine reads and writes rows: InnoDB, with transactions, row locks and crash recovery (Transactions and Locking). Accounts and metadata live in the mysql system schema in the same data directory.

MySQL AB released MySQL on 23 May 1995, named after co-founder Michael "Monty" Widenius's daughter My. Sun bought the company for $1 billion in 2008, and Oracle's purchase of Sun (January

  1. prompted Widenius to fork MariaDB 3,681 . The Community Edition is GPLv2; the commercial

Enterprise Edition adds plugins such as audit and thread pool. Percona Server 1,275 rebuilds each MySQL LTS, while MariaDB has diverged (its JSON is an alias for LONGTEXT); see MariaDB and Percona.