Alex Rivera | Logout

How do you set a default pager for the MySQL client?

Asked 2011-04-10T13:15:43.210
26

I know you can set a pager in mysql (the client program) using e.g. \P less. But how would one configure mysql so that your pager of choice is activated whenever you start using the client?

Edit
Report

1 Answer

32

To force this without having to pass parameters, you can put it in your my.cnf option file, under a [client] section (note that this is on the machine you're connecting from not to).

Something like this:

[client]
user = my_usual_user
host = my_usual_host
pager = less

If you want it to apply only to the actual mysql command, and no other applications that MySQL considers to be a 'client' (utilities like mysqldump read the [client] section too), then use [mysql] instead.

answered 2011-04-10T13:30:56.267

Your Answer