Home >Database >Mysql Tutorial >How Can I Find MySQL's Active Configuration File?

How Can I Find MySQL's Active Configuration File?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-01 09:46:10846browse

How Can I Find MySQL's Active Configuration File?

Unveiling MySQL's Configuration Secrets: Determining the Active Configuration File

Determining the configuration file used by MySQL 5.0 is crucial for tweaking database settings and troubleshooting. To address this need, the High Performance MySQL book by O'Reilly offers an insightful command-line solution:

/usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"

Executing this command clarifies the hierarchy of configuration files consulted by MySQL:

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

In this example, MySQL prioritizes loading settings from the following files:

  • /etc/mysql/my.cnf: System-wide configuration file
  • ~/.my.cnf: User-specific configuration file (located in the home directory)
  • /usr/etc/my.cnf: Default configuration file

The above is the detailed content of How Can I Find MySQL's Active Configuration File?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn