I installed MySQL and needed to configure it for a test replication. I needed to edit the my.cnf.
I tried to find the my.cnf on my CentOS BOX but file was not there. after looking around on net for hours, Found that my.cnf is not created automatically, and one has to create it himself.

Now Problem was where to create this my.cnf.

use following command

mysql --verbose --help

it will give you a lot of information, you need to find following text

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

so first mysql will look for file at /etc/my.cnf

Now how will i create the file, i have no idea what are the contents are the my.cnf

MySQL ships some sample configuration files while installation,

you can use this to locate where are the sample files.

locate *.cnf

and you will get something like following output.

[root@mysql-master ~]# locate *.cnf
[root@mysql-master ~]#

copy the file which suites your needs, i have a test VM so i will copy the least

cp /usr/share/mysql/my-small.cnf /etc/my.cnf

edit the /etc/my.cnf for your needs and restart the mysql

service mysql restart
Shutting down MySQL... SUCCESS!
Starting MySQL.. SUCCESS!