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.
Steps to install MySQL or MariaDB client on Ubuntu:
- Launch your terminal application.
- Update the system's package lists to ensure you get the latest version of the client.
$ sudo apt update
- Install the MySQL client using the apt package manager.
$ sudo apt install mysql-client
If you prefer the MariaDB client, replace mysql-client with mariadb-client in the above command.
- Confirm the installation by checking the client version.
$ mysql --version
If you installed MariaDB client, you should see something like mariadb Ver 15.1 indicating the version of the client.
- Use the client to connect to a remote database by providing the necessary credentials.
$ 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.
- To exit the client interface, type exit or press Ctrl + D.
- Optional: If you wish to uninstall the client, use the following command.
$ 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.
This guide is tested on Ubuntu:
Version | Code Name |
---|---|
22.04 LTS | Jammy Jellyfish |
23.10 | Mantic Minotaur |
24.04 LTS | Noble Numbat |
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.