Invoking MySQL Programs

A MySQL program can be invoked from the command line (i.e, from your shell or command prompt).

How to invoke?

This can be done by entering the program name followed by any options or arguments that would be needed to instruct the program to do what the user wants.

The below commands show some sample program invocations. The ‘shell>’ represents the prompt for the command interpreter; which is not part of what the user types. The specific prompt seen by user depends on their command interpreter.

Typical prompts are $ for sh, ksh, or bash, % for csh or tcsh, and C:\> for the Windows or cmd.exe command interpreters.


shell> mysql −−user=root test
shell> mysqladmin extended−status variables
shell> mysqlshow −−help
shell> mysqldump −u root personnel

Arguments which begin with a single or double dash (−, −−) specify the program options.

Options usually indicate the connection type of a program that should be made to the server or to affect its operational mode.

Nonoption arguments, i.e arguments which don’t have a leading dash, provide additional information to the program.


The mysql program interprets the first nonoption argument as a database name, which means that the command mysql −−user=root test indicates that the user would want to use the test database.

Some options are common to many of the programs.

The most frequently used options are the −−host (or −h), −−user (or −u), and −−password (or −p) options which specify connection parameters. These options indicate the host where the MySQL server is running, and the user name and the password of the user’s MySQL account.

Updated on: 09-Mar-2021


Kickstart Your Career

Get certified by completing the course

Get Started