Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 936 Bytes

MySQL - CLI.md

File metadata and controls

55 lines (39 loc) · 936 Bytes

CLI - mycli

output to file once: \o -o /tmp/f.csv

CSV format of data: \T csv example

\T csv
\o /tmp/data.csv
SELECT first_name, last_name, email FROM employees;

plain output \T plain with header \T minimal just list of stuff without header

List of output formats: \T

CLI - default

CSV

emp_db> \copy (SELECT first_name, last_name, email FROM employees) TO '/tmp/data.csv'

Credentials management

list all available credentials:

mysql_config_editor print —all

add new credentials:

mysql_config_editor set --login-path=LOGIN_PATH --host=HOST --user=USER --password

remove credentials:

mysql_config_editor remove -—login-path=LOGIN_PATH

mysql_config_editor creates and maintains encrypted ~/.mylogin.cnf

use credentials:

mysql --login-path=os-prod-orig dbname