Where is MySQL 5.7 my.cnf file?
Asked Answered
S

2

18

In Ubuntu I had my.cnf file of MySQL 5.6 in /etc/my.cnf. But I can't find the same file of MySQL 5.7. From where can I find that?

I did a find in entire / (root). But I couldn't find it anywhere. Any clues?

I'm trying to set max_connections value.

Shoeblack answered 20/7, 2016 at 21:1 Comment(6)
use mysqlworkbench to set the value.Engrain
what actual version do you have, try select @@version;Shearin
You have to create it. If it doesn't exist, default settings are used for everything.Shuffle
The doc is a bit clear on it. dev.mysql.com/doc/refman/5.7/en/option-files.html . see the comment at the bottom from Tim MAHER-DE TROYERShearin
Thanks Drew, I somehow missed that doc.Shoeblack
Does this answer your question? How do I find the MySQL my.cnf locationEquip
S
14

mysql --help printed below.

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

The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file,
                        except for login file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=#
                        Also read groups with concat(group, suffix)
--login-path=#          Read this path from the login file.
Shoeblack answered 21/7, 2016 at 5:29 Comment(0)
P
34

In MySQL 5.7, the default cnf is at:

/etc/mysql/mysql.conf.d/mysqld.cnf
Pride answered 3/3, 2017 at 3:11 Comment(2)
Just a note for people trying to set lower_case_table_names=1 (or 0, 2), type in terminal /etc/home$ mysqld --help --verbose and search for my.cnf, under default options look for places where my.cnf is supposed to be there and then check if actually they exist in file system, if any location is missing this file, copy the contents of mysqld.cnf and paste it in a new file named my.cnf (.my.cnf for ~/ dir).Lieb
The file is actually located at /etc/my.cnf or /etc/mysql/my.cnf It has been renamed from mysqld.cnf to just my.cnf in 5.7 dev.mysql.com/doc/refman/5.7/en/option-files.htmlOsanna
S
14

mysql --help printed below.

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

The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file,
                        except for login file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=#
                        Also read groups with concat(group, suffix)
--login-path=#          Read this path from the login file.
Shoeblack answered 21/7, 2016 at 5:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.