The MySQL and MariaDB client utilities enable users to interact with the respective database servers, making it possible to query, update, or administer databases without needing a full server installation. Such clients are essential for developers, database administrators, and anyone wanting to interact with a remote database server from their local machine.
Ubuntu repositories, by default, provide both MySQL and MariaDB client packages, giving users the flexibility to choose based on their server setup or personal preference. Installing a client package doesn't interfere with the other, which means you can have both clients installed on the same system and use them interchangeably.
For the sake of clarity and convenience, the steps mentioned below will guide you through the process of installing either the MySQL or the MariaDB client on an Ubuntu system.
$ sudo apt update
$ sudo apt install mysql-client
If you prefer the MariaDB client, replace mysql-client with mariadb-client in the above command.
$ mysql --version
If you installed MariaDB client, you should see something like mariadb Ver 15.1 indicating the version of the client.
$ mysql -h [remote-host] -u [username] -p
You'll be prompted for the database user password. Ensure you have the correct access rights to the remote database server.
$ sudo apt remove mysql-client
For removing MariaDB client, replace mysql-client with mariadb-client.
By following these steps, you'll be equipped to communicate with remote database servers using the client utilities. As a best practice, ensure your client version is compatible with the database server version for optimum performance and feature compatibility.
Comment anonymously. Login not required.