pager
command: mysql> pager more PAGER set to 'more' mysql> select title from sakila.film; +-----------------------------+ | title | +-----------------------------+ | ACADEMY DINOSAUR | | ACE GOLDFINGER | | ADAPTATION HOLES | | AFFAIR PREJUDICE | | AFRICAN EGG | | AGENT TRUMAN | | AIRPLANE SIERRA | | AIRPORT POLLOCK | | ALABAMA DEVIL | | ALADDIN CALENDAR | | ALAMO VIDEOTAPE | | ALASKA PHANTOM | | ALI FOREVER | | ALICE FANTASIA | | ALIEN CENTER | | ALLEY EVOLUTION | | ALONE TRIP | | ALTER VICTORY | | AMADEUS HOLY | --Plus--
SHOW ENGINE INNODB STATUS
(which can be quite large), you can use the pager
: mysql> pager grep sequence PAGER set to 'grep sequence' mysql> show engine innodb status\Gselect sleep(60);show engine innodb status\G Log sequence number 380166807992 1 row in set (0.41 sec) 1 row in set (1 min 0.00 sec) Log sequence number 380170274979 1 row in set (0.00 sec)
mysql> pager Default pager wasn't set, using stdout.
mysql> select count(*) from film left join film_category using(film_id) left join category using(category_id) where name='Music';
LEFT
joins to INNER
joins and use upper case for SQL reserved words. Instead of dull manual editing, just call edit
: mysql> edit
;
or \G
to run the query.tee
command, which logs all requests that you launched and their output: mysql> tee queries.log Logging to file 'queries.log' mysql> use sakila Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select count(*) from sakila; ERROR 1146 (42S02): Table 'sakila.sakila' doesn't exist mysql> select count(*) from film; +----------+ | count(*) | +----------+ | 1000 | +----------+ 1 row in set (0.00 sec) mysql> exit
queries.log
, you will see a copy of your session.Source: https://habr.com/ru/post/163545/
All Articles