Home >Database >Mysql Tutorial >How Can I Identify the MySQL Configuration File in Use?

How Can I Identify the MySQL Configuration File in Use?

Susan Sarandon
Susan SarandonOriginal
2024-12-03 06:11:10483browse

How Can I Identify the MySQL Configuration File in Use?

Identifying the MySQL Configuration File in Use

For MySQL 5.0, a simple command can identify the configuration file that the server is currently using.

Command:

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

Example Output:

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

Explanation:

  • The which mysqld command returns the path to the MySQL server binary.
  • The --verbose --help options generate detailed help information, including the configuration file locations.
  • The grep command filters the output to display only the lines containing "Default options" and the following line.

The output shows the configuration files in the order in which they are read:

  1. /etc/mysql/my.cnf
  2. ~/.my.cnf
  3. /usr/etc/my.cnf

The above is the detailed content of How Can I Identify the MySQL Configuration File in Use?. 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