First option
would change the MySQL pager as follows:
test.sh
#!/usr/bin/env bash # Some Basic Configuration db="homestead" dbuser="homestead" dbhost="127.0.0.1" # Executes the MySQL command using the basic configuration # This also sets the MySql Pager to less -Sin to enable # it also removes all lines starting with "*" mysql -h $dbhost -u $dbuser -p --pager="grep -Ev '(^\*.*$)|(^$)' | less -Sin" $db
Using
First change the Config variables:
$ nano ./test.sh
Secondly run the script
$ bash ./test.sh
Second option
Change the pager after you are already in the MySQL CLI
$ mysql -u root -p -h 127.0.0.1 somedatabase enter password: mysql> pager grep -Ev '(^\*.*$)|(^$)' | less -Sin
Dark-reaper-
source share