dan dan - 2 months ago 7
MySQL Question

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

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?

Answer

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.