Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using the mysql command line client and I do not want to need to provide the password every time I start the client. What are my options?

share|improve this question
    
Please accept answers on some of your previous questions, as it appears that several of those answers have been correct solutions - click the outlined checkmark to the left of the answer. –  Shane Madden Feb 10 '12 at 20:02

1 Answer 1

up vote 4 down vote accepted

Create a file named .my.cnf in your home directory that looks like this. Make sure the filesystem permissions are set such that only the owning user can read it (0600).

[client]
host     = localhost
user     = username.
password = thepassword
socket   = /var/run/mysqld/mysqld.sock
#database = mysql

Since you also tagged your question mysqldump you should look at this question.

Using mysqldump in cron job without root password

share|improve this answer
    
This is great it worked .. Thanku –  Trip Feb 14 '12 at 16:36
    
If the answer solved your problem then you should click the check mark to accept it. –  Zoredache Feb 14 '12 at 16:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.