MySQL Client Tips

Let us understand some of the client tips that are provided by MySQL −

Input-Line Editing

Mysql supports input-line editing, which allows the user to modify the current input line in place or recall the previous input lines.

Disabling Interactive History

The up-arrow key allows the user to recall input lines from current and previous sessions. In case where a console is shared, this behaviour may not be suited. mysql supports disabling of the interactive history partially or fully, and this depends on the host platform.

On Windows, the history is stored in memory. The keys ‘Alt+F7’ will delete all input lines stored in memory for the current history buffer

Unicode Support on Windows

Windows provides APIs that are based on UTF-16LE that are used to read from and write to the console. The mysql client for Windows can use these APIs. The Windows installer will create an item in the MySQL menu which is the named MySQL command line client - Unicode.

Displaying Query Results Vertically

Some query results are more readable when they displayed vertically instead of being displayed in the usual horizontal table format. Queries can be displayed vertically by terminating the query with the help of \G instead of using a semicolon.

Disabling mysql Auto-Reconnect

If mysql client loses its connection to the server when it is sending a statement, it will immediately and automatically try to reconnect to the server once and then send the statement again.

mysql Client Parser Versus Server Parser

The mysql client uses a parser on the client side which is not a duplicate of the complete parser that is used by the mysqld server on the server side. This may lead to differences in how certain constructs are treated. Let us see an example −

The server parser treats the strings that are delimited by " characters as identifiers instead of treating the plain strings if the ANSI_QUOTES SQL mode is enabled.

Updated on: 10-Mar-2021


Kickstart Your Career

Get certified by completing the course

Get Started