Skip links

Less typing with my.cnf

March 25, 2011 at 10:58 AM - by Freek Lijten - 2 comments

Tags: ,

I once read a lazy developer is a good developer. This makes me a good developer :) I just discovered a way to do less typing with a file called my.cnf

my.cnf is a MySQL configuration file used to configure all sorts of stuff. You can use it on multiple levels for global, server and user-specific options. If you want to know what is possible with it: click here. Interesting for sure, but how did it help me get more lazy? my.cnf lets you set options for specific programs/groups within the MySQL collection. You can set options for mysqld, a specific group and for a mysql client as well. In your home dir you caneither find or create the file .my.cnf. The following rule is now in my .my.cnf:


This makes sure that when I use the mysql command, the user root is assumed. All in all this saves me typing seven characters (-u root) when starting the mysql client. I do this several times a day which nets me the time to get myself an extra cup of coffee :D Since my local root user has no password, I don't need a password, but if you need it password=something will make sure you don't need to type that as well.

Share this post!


  1. Patrick van BergenPatrick van Bergen Wrote on May 6, 2011 at 2:39:43 PM

    En vergeet vooral niet dat het gaat om de 'user' in de [conf] sectie :) Er is ook een 'user' in de [mysqld] sectie. Die is van de server.

    Dank, Freek!

  2. Patrick van BergenPatrick van Bergen Wrote on May 6, 2011 at 2:41:24 PM

    Eeeeh, de [client] sectie. Waarom kan ik mijn reactie nou niet wijzigen in mod_weblog?

Leave a comment!

Italic and bold

*This is italic*, and _so is this_.
**This is bold**, and __so is this__.


This is a link to [Procurios](


A bulleted list can be made with:
- Minus-signs,
+ Add-signs,
* Or an asterisk.

A numbered list can be made with:
1. List item number 1.
2. List item number 2.


The text below creates a quote:
> This is the first line.
> This is the second line.


A text block with code can be created. Prefix a line with four spaces and a code-block will be made.