MySQL Program Option Modifiers


Some options are “boolean” and control the behavior which can be turned on or off.

Example

The mysql client supports a --column-names option which tells whether or not to display a row of column names at the beginning of the query results.

By default, this option is enabled. But sometimes, it may be required to disable this. This could be while sending the output of mysql into another program which is expecting to see only data and not the initial header line.

To disable column names, the options can be specified in any of the below mentioned forms −

Query

--disable-column-names
(or)
--skip-column-names
(or)
--column-names=0

The --disable prefix, --skip prefix and the =0 suffix all have the same effect. They turn the option off.

The ‘enabled’ form of the option can be specified in any of the below-mentioed ways −

Query

--column-names
(or)
--enable-column-names
(or)
--column-names=1

The values ON, TRUE, OFF, and FALSE are recognized for boolean options. These values are not casesensitive.

If an option is prefixed by --loose, a program doesn’t exit with an error if it doesn’t recognize the option. Instead, it issues a warning only. The below example demonstrates the same −

shell> mysql --loose-no-such-option

Output

mysql: WARNING: unknown option '--loose-no-such-option'

The --loose prefix can be used when the user runs programs from multiple installations of MySQL on the same machine as well as list options in an option file.

Updated on: 09-Mar-2021

160 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements