"mysql" Command Line Options in MySQL

Q

What Are the "mysql" Command Line Options in MySQL?

✍: FYIcenter.com

A

"mysql" offers a big list of command line options. Here are some commonly used options:

  • "-?" - Displays a help message on how to use "mysql" and terminates the program.
  • "-u userName" - Specifies a user name for the server to authenticate when connecting to the server.
  • "-p[password]" - Specifies a password for the server to authenticate when connecting to the server.
  • "-h hostName" - Specifies a host name where the MySQL server is running. The default host name "localhost".
  • "-P portNumber" - Specifies a port number where the MySQL server is listening for connections. The default port number is 3306.
  • "-e command" - Executes the specified command and terminates the program.
  • "-t" - Specifies that the query output is displayed in text table format. This is the default display format for interactive mode.
  • "-H" - Specifies that the query output is displayed in HTML table format.
  • "-X" - Specifies that the query output is displayed in XML element format.

Here is a tutorial exercise of how to use the "-?" option with "mysql":

>cd \mysql\bin
>mysql -?
mysql  Ver 14.12 Distrib 5.0.24, for Win32 (ia32)
Copyright (C) 2002 MySQL AB
...
Usage: mysql [OPTIONS] [database]
  -?, --help    Display this help and exit.
  -I, --help    Synonym for -?
  --auto-rehash Enable automatic rehashing. One doesn't 
                need to use 'rehash' to get table and field
                completion, but startup and reconnecting may
                take a longer time. Disable with 
                --disable-auto-rehash.
  -A, --no-auto-rehash
...

 

"mysql" Command Line Arguments in MySQL

"mysql" - Command Line End User Interface in MySQL

Command-Line End User Interface 'mysql'

⇑⇑ MySQL Database Tutorials

2018-04-28, 1838🔥, 0💬