I'm constantly jumping into and between multiple databases as multiple users (test, standard, mysql) it becomes a little dangerous and I'm finding myself checking where I am and who I am:
SELECT user();
SELECT database();
but you can change the standard mysql prompt to display the user and database! Just edit the my.cnf file and place the following under [mysql]:
prompt=\\u@\\d:
Now my prompt looks like this:
paul@test:
or
root@main:
If you don't have permissions to alter the my.cnf directly, then you could change your personal .bashrc (or equivalent) to contain something like this:
alias mysql='mysql --prompt="\u@\d:"'
This has saved me a lot of paranoia (and probably some headaches).
No comments:
Post a Comment