Friday, 5 October 2012

Useful mysql commands

So, using MySQL on the command line I faced the annoyance that any tables I completed were not subject to autocomplete during that session. It really is so much quicker when table names and columns autocomplete.


It was one of the more challengingly obscure thing to find on google since I wasn't really sure what I was looking for.

Finally discovered it was called 'rehashing'.


Slashdot suggests that you can set up auto-rehash by either opening the client using the command
mysql --auto-rehash -u root -p

or putting it into the my.cnf file:
[mysql]
auto-rehash

source: http://stackoverflow.com/questions/8332338/mysql-console-autocomplete-names


To do it in an active session I finally found the commands
\# 
or
rehash

source: http://kedar.nitty-witty.com/blog/5-useful-mysql-command-options-pager-prompt-rehash-tee-system 






update - another one (23/10/2015). to view one screen of results at a time, you can use less:
pager less;


to revert back to standard output
pager;