1

I'd like to display result of my queries page by page, for example I have a Mysql db with a lot of tables and I need to see the result of show tables; as one screen at a time, similar to more command. I know I can do a mysql mydb -u username -p -e 'show tables;' | more but I need it inside inside db shell (MySQL Command-Line Tool).

So simple but I couldn't find it

PHA
  • 1,588
  • 5
  • 18
  • 37

3 Answers3

4

As Javier said here is the answer:

mysql> pager less;

mysql> show tables;
Community
  • 1
  • 1
PHA
  • 1,588
  • 5
  • 18
  • 37
  • 1
    You can leave your custom pager, and come back to default pager: mysql> pager; – PHA Sep 15 '15 at 09:17
1

You can use LIMIT in mysql query

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'database_name' AND TABLE_NAME LIKE "a%" LIMIT 0,20;

Neeraj Sharma
  • 1,322
  • 10
  • 9
  • LIMIT works fine but I didn't want to modify queries whenever their results go more than a certain range. – PHA Sep 15 '15 at 08:35
0

I would Like to add here, to exit the pager screens you simply press q to return to the terminal

BeanyTheSane
  • 51
  • 2
  • 4
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/29882047) – JimmyBlu Sep 21 '21 at 20:58