On Windows
MySQL starts up with configurations defined in a file named “my.ini”. To find where the active “my.ini” configuration file is located on the Windows Server:
Step 1) Open Windows Services (e.g. start –> run –> “services.msc”)
Step 2) Find the appropriate MySQL Service entry (e.g. “MySQL” or “MySQL56”), in this example it’s “MySQL80-3307”
Step 3) Right click and select Properties
Under the text “Path to executable”, the path to the “my.ini” file shown next to the parameter “–defaults-file”
In this example, the location of the my.ini file is:
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
On Linux
MySQL starts up with configurations defined in a file named “my.cnf”.
To find where the active “my.cnf” configuration file is located on the Linux Server:
Step 1) From a Terminal/Shell/Command Line, execute the command: mysql –verbose –help
The command will yield a long list of text as the result.
Step 2) Scroll to below the “Usage: mysql [OPTIONS] [database] section” and below the line that reads: “Default options are read from the following files in the given order:“, there will be an ordered list of possible filesystem locations for the my.cnf file. In this example, there are 4 locations will which MySQL will look for.
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
To made configuration changes, modify the first available file (from left to right), in this example this would be “/etc/my.cnf”