Tuesday, September 19, 2006

Connecting to MySQL without a password

Things have been quite busy lately. I took Friday off as my mom was scheduled to leave on Sunday. She was visiting me after 6 years. My long weekend however flew faster than I could spell MySQL.

Now that I have my plane tickets booked for the MySQL camp, I am very excited as I cannot wait to see my friends there. If you are planning to come, and your name isn't listed, please take a few moments to add it to the participants list.

Today, I was asked by a friend if there was a way to login to MySQL without having to specify password each time.

Sure, there is. If MySQL finds a .my.cnf file in your home directory it will read it and apply the configuration specified there. What that means is that if you place your user name and password in that file then you don't have to keep specifying the username and password.

For instance, you can put something like:
[mysql]
user=user
password=pass
[mysqladmin]
user=user
password=pass


This will save you having to type the boring username and password every time.

4 Comments:

At 7:45 AM, Blogger Creative Times said...

This is useful but this will compromise the database server's security.

 
At 12:00 PM, Blogger Alicia said...

But where can I find that .my.cnf file? is that file in the client or server side?

 
At 4:00 PM, Anonymous Anonymous said...

Is there any solution how to connect from Perl, Python, PHP etc. without password?

 
At 7:56 AM, Anonymous Anonymous said...

Thank you

 

Post a Comment

<< Home