Excute SQL from shell
shell> mysql -e (or --excute) "SELECT DATABASE(); SELECT VERSION();"
Statement Terminators
\c to cancel current statement
\q to exit mysql comand console
\g is terminator
\G is terminator plus output vertically
Using Script Files
mysql> SOURCE input_file
shell> mysql de_name < input_file
Output Formats
--batch (or -B) tab-delimited output
--table (or -t) tabular output
--html (or -H) HTML format
--xml (or -X) XML format
Clinet Commands and SQL statements
mysql> STATUS;
mysql> HELP item;
- ANSI_QUOTES
- The double quote character is interpreted as an identifier-quoting character.
- IGNORE_SPACE
- Ignore spaces after function names.
- ERROR_FOR_DIVISION_BY_ZERO
- The default is that MySQL returns NULL rather than a warning (or an error in strict mode.)
- STRICT_TRANS_TABLES, STRICT_ALL_TABLES
- Switching on 'strict mode.' STRICT_TRANS_TABLES is only for transactional tables.
- TRADITIONAL
- strict modes plus several additional restrictions.
- ANSI
- enables behaviors are more like ANSI SQL (ex. ANSI_QUOTES, PIPES_AS_CONCAT)
*SHOW WARNINGS shows MySQL warnings.