14

In short, what configuration values does MySQL use if there is no my.cnf?

I'm running MySQL on Slackware. I've been using it for a while with ISAM and InnoDB tables. I never configured a my.cnf file. Oops. Now I'd like to do that, but I don't know what settings it is using currently, and I'd like to know before I install a my.cnf file and possibly change things.

I've done MySQL --help and checked the locations given.
I've done find / and I'm certain there is no my.cnf or .my.cnf file anywhere.
I've done ps aux and no --defaults_file is being specified.

These files exist:

/etc/my-medium.cnf
/etc/my-huge.cnf
/etc/my-small.cnf
/etc/my-large.cnf

/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-small.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-large.cnf

Marnen Laibow-Koser
  • 5,959
  • 1
  • 28
  • 33
Charles
  • 167
  • 1
  • 1
  • 9
  • Hey, my answer is actually better than the one you accepted. You really shouldn't trust the files mysql delivers, instead you should buld your own configuration. – markus Apr 06 '13 at 19:52
  • Unfortunately users with <100 rep normally grab an answer and never again visit. Since its two YEARS old, probably he won't even log, much less care about changing the green mark. My money is on you, @markus but alas... – Mindwin Remember Monica Feb 20 '14 at 13:48
  • 2
    I am an infrequent visitor but I do try to keep up. However I am sorry to disagree, the accepted answer provided exactly the information I requested, although Markus' answer is indeed rock solid advice. – Charles Feb 20 '14 at 14:54

2 Answers2

18

If it can't find a my.cnf or my.ini file, MySQL will use its compiled-in defaults. The .cnf/.ini files are not necessary unless you want to override those defaults.

The medium/huge/small/large files you found are suggested setups for that "size" of server. Just pick the one in /etc that suits your needs and rename it to my.cnf (in the same directory), restart mysql, and it should make that configuration take effect.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • thank you for your response. This is helpful. One follow up I do have is how do I know what those defaults are? – Charles Jan 26 '11 at 18:33
  • I've been looking over this and it looks like the most options have defaults listed in documentation. – Charles Jan 26 '11 at 19:22
12

Do not trust defaults

I'm doubting you're actually running mysql without configuration at all. If so, you're running with all the default values which is not only highly inefficient but also insecure!

Do not trust the templates provided by mysql

Unfortunately the files you mention that are suggested by mysql all littered with bad practice and outdated/deprecated configurations. I advice not to trust them but learn about how to really configure your mysql server by searching the web for tutorials about sensible mysql configuration. There is a lot of good material out there.

Create your own configuration, it's the best way of learning about what your database server can do!

Community
  • 1
  • 1
markus
  • 40,136
  • 23
  • 97
  • 142