Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pause output of select statement?

Status
Not open for further replies.

mysqlfrk

Programmer
Aug 3, 2011
12
Hi
I am using Windows XP & xampp shell console for mysql. I have employees table which has more than 100 records and when I use "select * from employees" query in MySQL is used the result rolls down without pausing per page.But i want to see the output Pauseing after each screenful of information like in "dir /p |more" in DOS.
Is there any such way out in MYSQL??
Also when I Alt+Enter to maximise the screen,is there a way to scroll up and see the results of my last query without using arrow keys to return to the last query and executing it again?
Hope you all get me.
Please help.
Thanks in advance

 
Hi

mysqlfrk said:
But i want to see the output Pauseing after each screenful of information like in "dir /p |more" in DOS.
On Linux such tasks are done by the pager applications. Searching for that keyword in your documentation will probably lead you to the solution on Windows too.

On Windows the most common pager is [tt]more[/tt], so try using that first. If the pager is not set yet, execute [tt]pager more[/tt] at the MySQL command-line tool's prompt, or add [tt]--pager=more[/tt] to the [tt]mysql[/tt] command when starting the tool. Once set, you can activate the pager with [tt]pager[/tt] or inactivate it with [tt]nopager[/tt].

To set it permanently you can add this to an option file :
Code:
[client]
pager=more


Feherke.
 
Sir,
The pager command is not working.
 
why do you need to view the results from the client window? Can't you output them to a file if you have to view them?

There are also many GUIs you can use for the front end that allow easier viewing of your results.
 
Can you name some of the GUI interfaces please?
And also can you please tell me how to output the results of a query to a file if you have to view them?
 
MySQL Workbench is one, HeidiSQL another PHPMYADMIN a third. There are others.

If you look at a SELECT statement in the manual you can see that you have the OUTFILE option to output your query to a file. Note that the user logged in to mysql must have FILE permissions to do so.

Alternately when you start the mysql client you can start with the --tee option on and that will write everything you do to a file. you have to specify the file name at start-up if you do.

You can also switch to it while inside of mysql.
\T filenamegoeshere

and end writing to the file with \t

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top