I use the mysql command line client frequently. Sometimes I wind up typing in my password dozens of times per day, and I'm getting really tired of it.
SSH has a neat utility called ssh-agent which lets you type in your password just once at the beginning of the day. Is there a similar utility for MySQL?
Create a
~/.my.cnf
file in your $HOME with below content:and make it can be readable by only you:
No. However, you can store your password in a my.cnf file in your home directory. For example, on linux
You can also store user and host there. These options will be used by all mysql clients unless you override them. If you often connect to the same server with the same credentials, setting these can save you a lot of typing.
You need to make sure that your my.cnf is only readable by your user. For example,
chmod 600 ~/.my.cnf
.Yes, there is. Run the following, and type your password.