Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

unable to find my.cnf

I have installed mysql community server from rpm

its runing fine,
but i dont understand where is my.cnf
i have checked /etc/my.cnf its not there
find / -name my.cnf   = no luck ..
where is that ??
  • 5
  • 3
  • 3
  • +6
1 Solution
Aleksandar BradarićSoftware DeveloperCommented:
Try /etc/mysql/my.conf
it could be with a different name or case sensitive or if not present run with default values
Aleksandar BradarićSoftware DeveloperCommented:
It might not even be there if your server runs with the default params only, but if you want to create it, that's where it should be: /etc/mysql/my.conf
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

yusuf01Author Commented:
NO its not there

normally i use, yum install mysql-server
so it always /etc/my.cnf
this time i use from rpm , adn its not anywhere in the system...

so suppose if i want to crease buffer size or enable log or something, where will i do ?
Loganathan NatarajanLAMP DeveloperCommented:
just locate the file

>> locate my.cnf

Open in new window

yusuf01Author Commented:
tryed that


locate my.cnf  = no luck ...
Aleksandar BradarićSoftware DeveloperCommented:
As I said - create the file and put it in one of these places:

1. if there is a /etc/mysql/ dir on the system, put it in there
2. if there's no /etc/mysql/ dir, then put it where it was before (e.g. /etc/my.cnf)
How about (as root):

# find / -name my.cnf
yusuf01Author Commented:
@tcengineer:, i have tryed that command , if you check my previous post

@leannonn: so you saying, if i cretae a my.cnf file manuay then it will work ?? sure 100% ??
Michael WorshamInfrastructure / Solutions ArchitectCommented:
If you still have the RPM files available, do this:

'rpm -qpl MySQL-server-community-5.1.33-0.rhel5.i386.rpm | grep -i my.cnf'

It will tell you the location of the my.cnf and where it was extracted to.

yusuf01: Just for the record, my cnf is also in /etc/mysql/.
Regardless, to answer your last question:
If you create your own file, a NORMAL mysql server will search like this:

1) /etc/my.cnf         //If this file is found, it's settings are applied to ALL mysql servers
2) MySQL stores it's databases in
   A) /usr/local/mysql/data for a binary installation, or
   B) /usr/local/var for a source installation
   If a my.cnf this file is found in the respective database directory, all settings in that file will overrule the same previous rules in the /etc/my.cnf
3) Lastly, the server will search in it's ~/.my.cnf, and those rules will overrule again.

This is documentet in the manual.

Ofcourse, someone could have changed these settings in your rpm, I can't make any guarantees about that.

Good luck

grep mysql -ir /etc/
yusuf01Author Commented:
Hi guys, sorry due to night could not able to reply

[root@localhost tmp]# rpm -qpl MySQL-server-community-5.1.33-0.rhel5.i386.rpm | grep -i my.cnf
[root@localhost tmp]#

thats make me wonder, how comes i dont have my.cnf.
if i do show variables
 datadir       | /var/lib/mysql/  

so its getting those info from somewhere .. but dont understand why

@ai_ja_nai: that command return too many lines ...
but is not that same thign as
find / -name my.cnf
or locate my.cnf ??

Since the rpm does not seem to install a cnf for you, the server must be running on "defaults".

I'd try putting
max_allowed_packet = 1M
I'm /etc/my.cnf
Then import a file larger than 1MB. If the connection drops, increase 1 to something big enough to handle the file, and try again. If it works, that's where you should put your settings.

I'm sure there's something else similar that you can do, like change the port or some such, but that's what I'd do.
Michael WorshamInfrastructure / Solutions ArchitectCommented:
See if you have a /usr/share/mysql directory.

If so, copy the my-medium.cnf to /etc/my.cnf and then restart MySQL.
>@ai_ja_nai: that command return too many lines ...
>but is not that same thign as
>find / -name my.cnf
>or locate my.cnf ??

not at all ;) grep mysql -ir /etc/ will search inside files inside /etc the string mysql (case insensitive); locate and find (which are the same thing, the first builds an index based on a run of the second and then it always looks on that index) can only look on filenames
try looking for this, they are string that must be inside a my.conf file

grep mysqld -ir /etc/

grep key_buffer_size -ir /etc/
My name is MudCommented:
Depending on your Linux distribution your MySQL server may already be configured with a minimum configuration file and is ready to run, otherwise you may need to create a configuration file before the server can be activated. This is not a big problem as some sample configuration files have been provided that are already tuned to a particular purpose depending on the role of the server.

Sample File:
      Used For:
my-huge.cnf       Large site, fully dedicated mysql server, 1-2GB RAM
my-large.cnf       Large site, mostly dedicated mysql server, ~512MB RAM
my-medium.cnf       Medium site, shared server running mysql, > 64MB RAM
my-small.cnf       Small site, shared server running mysql, < 64MB RAM
File Locations: /usr/share/doc/mysql-server-?.??.??

taken from brennan howto...
yusuf01Author Commented:
I had to create,
if you install from rpm , you dont get any my.cnf

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
  • 3
  • 3
  • +6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now