You obviously need the full MySQL server on the database server.
On the web server, you will have code written in PHP,Python,etc that communicates with the database using features most commonly provided by the language itself. For example, PHP has mysql
and mysqli
extensions that provide PHP functions to talk to MySQL.
Regardless of the language used, these MySQL functions will almost always rely on using the MySQL client library to actually talk to the MySQL server. The client library is provided by MySQL and handles all the low-level parts of talking directly to the MySQL server. The client and server are developed in tandem and the client is also used by the MySQL cli.
MySQL provides a client only install option that only installs the client libraries (and mysql
cli command), which are fairly light-weight. You do not need the full MySQL server installed on the web server.
Ideally it makes sense to have the client and server using the exact same version of MySQL, as they will support exactly the same features, but it's not completely necessary. However, you may run into issues if the server is new and the client is very old, or visa-versa as the MySQL authentication process was changed several years back that made it a bit awkward, although it was still possible to make it work.
I wouldn't recommend running any MySQL software, client or server, that's that old though.