Mysql client

From wikinotes
Revision as of 22:36, 26 November 2020 by Will (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Commandline client for mysql.

Alternatives

mycli mysql client based on prompt toolkit

Usage

mysql -u USER \
      -h ADDR \
      -D DATABASE
# If you have too many rows for your console, you can end query in 
# \G and the format will be altered for readability.
SELECT * FROM sometable\G

# also, you can use less as your pager
pager less -SFX

Configuration

vi mode

mysql uses gnu readline. To enable vi mode simply:

linux, macos<=10.4

# ~/.inputrc
set editing-mode vi
set keymap vi

macos>=10.5

# ~/.editrc
bind -v