my.cnf is the configuration file loaded when MySQL starts. It is usually placed in the MySQL installation directory, but users can also load it from other directories. After installing MySQL, there will be multiple my.cnf files in the system, some of which are used for testing. Use the locate my.cnf command to list all my.cnf files Order locate my.cnf Output /usr/local/Cellar/mysql/5.6.24/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/include/default_my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/federated/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/ndb/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/ndb_big/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/ndb_binlog/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/ndb_rpl/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/ndb_team/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/rpl/extension/bhs/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/rpl/my.cnf /usr/local/Cellar/mysql/5.6.24/mysql-test/suite/rpl_ndb/my.cnf When we need to modify the configuration file, we need to find out which my.cnf file is loaded when MySQL starts. 1. Check whether my.cnf in the specified directory is used After starting mysql, we check the mysql process to see if there is a my.cnf file set to use the specified directory. If so, it means that this configuration file was loaded when mysql started. Order ps aux|grep mysql|grep 'my.cnf' Output fdipzone 25174 0.0 0.0 3087244 600 ?? S 4:12 PM 0:01.14 /usr/local/Cellar/mysql/5.6.24/bin/mysqld --defaults-file=/usr/local/Cellar/mysql/5.6.24/my.cnf --basedir=/usr/local/Cellar/mysql/5.6.24 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.24/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/TerrydeMacBook-Air.local.err --pid-file=/usr/local/var/mysql/TerrydeMacBook-Air.local.pid fdipzone 25064 0.0 0.0 2452824 4 ?? S 4:12PM 0:00.03 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --defaults-file=/usr/local/Cellar/mysql/5.6.24/my.cnf --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql You can see that /usr/local/Cellar/mysql/5.6.24/my.cnf is the configuration file loaded by mysql startup. If the above command does not produce any output, it means that my.cnf is not set up to use the specified directory. 2. Check the directory where MySQL reads my.cnf by default If you do not set my.cnf to use a specific directory, MySQL will read the my.cnf files in the root directory of the installation directory and the default directory when it starts. View the default directory for reading configuration files when MySQL starts Order mysql --help|grep 'my.cnf' Output order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, ~/.my.cnf These are the directories where mysql will search for my.cnf by default, with the ones at the top having priority. 3. No configuration file is used at startup If the specified directory my.cnf file is not set and there is no my.cnf file in the default reading directory, it means that the configuration file is not loaded when MySQL starts, but the default configuration is used. If you need to modify the configuration, you can create a my.cnf file in the directory that MySQL reads by default (for example: /etc/my.cnf), write the configuration content that needs to be modified, and restart MySQL to make it effective. The above article "How to view the currently used configuration file my.cnf in MySQL" (recommended) is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
>>: Detailed explanation of Docker data management (data volumes & data volume containers)
I have newly installed MySQL 5.7. When I log in, ...
1. WebDesignerWall 2. Veerle's Blog 3. Tutori...
1. Use CSS to draw a small pointed-corner chat di...
Development environment windows Development Tools...
1. Multiple calls to single arrow Once a single a...
Use div to create a mask or simulate a pop-up wind...
Install MySQL 8.0 docker run -p 63306:3306 -e MYS...
Table of contents Purpose of the table For exampl...
1. es startup command: docker run -itd -e TAKE_FI...
In fact, it is very simple to achieve this effect,...
Replace it with the optimal database connection p...
In rows, dark border colors can be defined indivi...
constraint Constraints ensure data integrity and ...
Implemented according to the online tutorial. zab...
Preface As we all know, by default, the MySQL ins...