MySQL Clients (Articles -10).

Share via:

MySQL Clients

Learning Objectives :

  • List the available clients for administrative tasks and their basic  purposes.
  • Invoke mysql clients and common command line options.
  • Invoke and us the MySQL command line client MySQL.
  • Use the mysqladmin for administrative clients APIs (Drivers and Connectors).


Overview of Administrative Clients :

Command line clients programs for DBA’s.

  • mysql
  • mysqladmin
  • mysqlimport
  • mysqldump

To know what are all options mysql will support you can check using mysql –help command.

How to connect MySQL using mysql command :

mysql <option1> <option2>…

mysql –u<username>

-p <password> (you can give your password or you can press enter and type password when it port for it)

-P <port number> (default port number 3306 if mysql is not running on default port you need to specify here)

-h <host number> (if you are connecting from remote host give host name/ip address)


There are 2 categories of switches supported by mysql command line :

Short format

Long format.


Where you are specifying –u or –p or any other option


Where you specifying –user=<username>

We can execute mysql commands in two modes.They are :



Interactively :

We are executing commands by connecting mysql > prompt.

Directly :

We are executing commands from operating system prompt.(but its insecure)

we will use for day to day tasks).

You can manually check for contents for help for mysql command, execute mysql> help contents this will show you list of categories of content.

For example let’s check what are functions are available in Functions.

In above date and time function below listed options are available.

To get example how to use above options execute mysql> HELP ADDDATE;

There are two ways to execute query one way is by executing query after connecting to mysql prompt and another way is you can execute quires from OS prompt without connecting mysql.

As shown below you can append query to mtsql –u<user> -e “<query you want to execute>”


If you want to execute multiple commands in that case separate them with semicolon ( ; ) as shown below.

We can also  write multiple queries  .


Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTEXPERTS is always active on below social media platforms.

Facebook :
LinkedIn :
Twitter :
YouTube :
Instagram :

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Add Comment