Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top