What does mysql use if there is no my.cnf?
Asked Answered
T

2

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

That answered 26/1, 2011 at 18:26 Comment(3)
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.Titular
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, @Titular but alas...Cnossus
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.That
R
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.

Retinitis answered 26/1, 2011 at 18:28 Comment(2)
thank you for your response. This is helpful. One follow up I do have is how do I know what those defaults are?That
I've been looking over this and it looks like the most options have defaults listed in documentation.That
T
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!

Titular answered 23/11, 2012 at 21:31 Comment(1)
+1 for paranoia (always healthy) and for telling people to go learn how to config it for real.Cnossus

© 2022 - 2024 — McMap. All rights reserved.