Ubuntu – Does installing thesql-server include thesql-client as well

aptMySQLserver

I was wondering what the difference is between mysql-server and mysql-client and came upon this stackoverflow post explaining the difference. I was curious if installing mysql-server also included mysql-client. So, after creating a fresh AWS Ubuntu instance, I ran which which mysqld and which mysql to confirm nothing came preinstalled with the AWS instance, and sure enough both commands returned nothing. However, after running sudo apt install mysql-server, when I ran which mysql and which mysqld they both returned something: which mysqld returned /usr/sbin/mysqld and which myself returned /usr/bin/mysql, suggesting that my installation of mysql-server installed both the client and the server. Is that accurate? As I mentioned, the stack overflow post I visited earlier indicated they were distinct pieces of software, so I'm wondering why installing mysql-server would install the client as well?

Best Answer

They are separate pieces of software, but installing mysql-server installs mysql-client as well, because you can use mysql-client to connect to the server, even over localhost. If you look at the package listing for mysql-server, you will see it depends on mysql-server-8.0, which depends on mysql-client-8.0, causing apt to install the client as well.