Log in to MySQL without password prompt

To allow you to log in to MySQL without having to type a password at the prompt, add your password to a file called .my.cnf in your home directory.

[client]
user=the_user
password=the_pass

Important: Make sure the file is readable only to you, by changing its permissions to r-------- (400) or rw------- (600):

chmod 600 .my.cnf

References

MySQL :: MySQL 6.0 Reference Manual :: 5.5.6 Keeping Your Password Secure

Last modified: 25/06/2008 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top