MySQL View the currently used configuration file My.cnf method (recommended)

Source: Internet
Author: User
Tags mysql view

my.cnf is a configuration file that is loaded at MySQL startup and is typically placed in the MySQL installation directory and can be loaded by users in other directories.

After installing MySQL, there will be multiple MY.CNF files in the system, some of which are for testing.

Use the locate my.cnf command to list all my.cnf files

Command

Locate MY.CNF

Output

?
1234567891011 /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 was loaded when MySQL started.

1. See if the my.cnf of the specified directory is used

After starting MySQL, we look at the MySQL process to see if there is a my.cnf file set up using the specified directory, and if so, this is the configuration file that was loaded when MySQL was started.

Command

PS aux|grep mysql|grep ' my.cnf '

Output

?
12 fdipzone     25174  0.0 0.0 3087244  600  ?? S   4:12下午  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.pidfdipzone     25064  0.0 0.0 2452824   4  ?? S   4:12下午  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 MySQL boot loaded configuration file.

If the above command has no output, MY.CNF is not set using the specified directory.

2. View MySQL default read my.cnf directory

If you do not set a My.cnf,mysql startup with the specified directory, the root directory of the installation directory and the my.cnf file under the default directory will be read.

View the default directory for reading the configuration file when MySQL starts

Command

MySQL--help|grep ' my.cnf '

Output

?
123 orderofpreference, 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 MySQL default will search my.cnf directory, the order of precedence before the queue.

3. No configuration file used at startup

If no my.cnf file is set using the specified directory my.cnf file and the default read directory, it means that the configuration file is not loaded when MySQL starts, but instead uses the default configuration.

To modify the configuration, you can create a my.cnf file (for example:/ETC/MY.CNF) in the directory that the MySQL default reads, write the configuration that needs to be modified, and then take effect after restarting MySQL.

Above this MySQL view the current use of the configuration file My.cnf method (recommended) is a small part of the whole content to share to everyone, I hope to give you a reference, but also hope that we support the script home.

Articles you may be interested in:
    • MySQL configuration File My.cnf example most detailed translation
    • MySQL config file my.cnf Chinese version comparison
    • MySQL configuration file my.cnf in Chinese detailed MySQL performance optimization method sharing
    • MySQL configuration file my.cnf parameter optimization and Chinese explanation
    • MariaDB (MySQL branch) my.cnf configuration file Chinese annotation version
    • MySQL Performance optimization Path---Modify the configuration file my.cnf
    • MySQL configuration file my.cnf optimization (mysql5.5)
    • MySQL config file my.cnf workaround due to permissions issues that cannot be started

MySQL View the currently used configuration file My.cnf method (recommended)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.