Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is MySQL required on both the MySQL database server and the web server that it is connecting to? If it is required on both the web server and database server, please explain why this is.

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.

I appreciate any advice as my knowledge of managing servers is very limited.

share|improve this question

4 Answers 4

up vote 9 down vote accepted

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.

share|improve this answer
    
Except in the case of bugs in specific releases, the general rule is that the client code should be the same version or newer than the server, since a newer client is more likely to fully anticipate an older server's requirements, although there is a broad swath of cross-compatibility among 5.x code versions. (+1) –  Michael - sqlbot Dec 18 '13 at 17:58

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.

share|improve this answer
    
Thanks for the reply, what if there is no local DB and all DB interactions are back-end? –  AnchovyLegend Dec 18 '13 at 14:13
1  
Then no, you don't need a "local" copy of mysql running on the web server. A webserver can (in fact I'd suggest should, where possible) be nothing more than a webserver. –  RobM Dec 18 '13 at 14:15
1  
You will need some sort of MySQL client on the Webserver to allow it to connect to the MySQL server –  Jaydee Dec 18 '13 at 14:51
    
If I am using PHP, isn't the MySQL client built in to the language? OR Do I have to install it on the web server? –  AnchovyLegend Dec 18 '13 at 14:56

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

share|improve this answer

Basically you don't have to host MySQL on webserver. You could host hem separately which is much better from the point of view of the performance. You might want to take a look at client-server architecture overview. I believe it would clear things up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.