When is mysql-client needed?

R.Neville asked:

I have read a number of tutorials on installing MySQL, and I’ve noticed that many of them only discuss installing mysql-server, whereas some also discuss installing mysql-client. My main question is: when is it necessary to install mysql-client?

It seems that when I remove mysql-client from my system, I can still access mysql-server from the command line (simply by issuing mysql -u root -p). How is mysql-server accessible without mysql-client installed?

My answer:

The mysql-client package is a metapackage with no real files of its own (except for boilerplate copyright, etc.). Its sole purpose is to depend on the actual package containing the latest version of the MySQL client, which in bionic is mysql-client-5.7. Thus when you instal mysql-client on any version of Ubuntu, you will get the latest version of MySQL available, and when you upgrade Ubuntu to another major version, MySQL will also be upgraded. Which also means that if you remove this file and leave mysql-client-5.7 then on upgrade either your client and server versions will be out of sync, or the upgrade will fail with dependency problems.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.