How to Install MySQL Client on Ubuntu

How to Install MySQL Client on Ubuntu

MySQL is popular is popular open-source relational database management system. The program that interfaces with the server is known as a MySQL client. The most basic client that you can use is the command line tool, most commonly known as MySQL client.

To install the mysql client on Ubuntu 18.04, open the terminal window and execute:

apt-get install mysql-client

The command-line tools allow you to interact with the server and It also allows you to run MySQL commands in shell scripts and other programs (For example, cron to perform maintenance and backup jobs).

The Ubuntu mysql-client package includes following command line tools (and more):

  • mysql - the mysql command-line client to run SQL statements.
  • mysqladmin - client for administering a MySQL server.
  • mysqldump - a database backup program. The mysqldump command writes the contents of database tables into text files which you can use to restore databases.
  • mysqlreport - Makes a friendly report of important MySQL status values.
  • mysqlcheck - a command line client to check, repair, and optimize tables.

The Ubuntu MySQL client can install as a stand-alone command-line tool, for example, you can install mysql server on one computer and the client package on another computer running Ubuntu operating system. In that case you need to use -h flag with mysql client to indicate the server IP address or domain name.

Note that mysql server should allow remote access to the server, in order for the MySQL client to connect from a remote location.