Is MySQL required on both the database server and the webserver? why?

Solution 1:

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.

Solution 2:

I'm afraid the answer to all your questions is "it depends".

Is MySQL required on both the MySQL database server AND the web server that it is connecting to?

It depends on how your web app is built. If you have a web app that provides access to a back-end database but uses a local one to store, for example, user logons then it's possible. You'd need to ask the developer.

Moreover, if it is required on both, is it required or recommended that both the database server and web server have matching versions of MySQL, please explain.

Again, depends on the requirements of the web app. Operationally, I would suggest that supporting only one version of a platform is easier than supporting two different versions, however.

Solution 3:

I don't really understand but i will try to answer

You have to install (depends on the workload) : mysql-server on a separate serveur mysql-client on the web server. Mysql client permit you to connect to the mysql server. It's not a server process! This is two differents and independants packages.

There are some over packages you can install on the server depends on your needs like mysql-shared, devel for a redhat like ... ect

If you want use Php with mysql, you can compile it with mysqli support. There are a lot of documentation about this.

Sorry for my poor english