• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to find location of MySQL configuration file(s)

By admin

MySQL can read configuration files from different locations, which depend on configuration, platform and build options. Steps below will show a universal approach to list all locations where the configuration file is being looked.

1. Make sure that mysqld process is started without explicit –defaults-file or –defaults-extra-file parameters. Following commands will display actual arguments mysqld is started with:

Linux:

$ ps aux |grep mysqld

Solaris:

$ /usr/ucb/ps -alxwww | grep mysqld

Windows:

Command line arguments are observed in Task Manager when column ‘Command line’ is enabled. (View->’Select Columns’ menu option).

2. Following command will show locations where mysqld process reads configuration files:

Please note that if your MySQL server startup command uses any of options –datadir or –basedir explicitly, you should append them to the list of parameters in the command below to see locations of configuration files.

Unix-like systems:

$ mysqld --help --verbose 2>1 | grep "/my.cnf"

Windows:

% mysqld --help --verbose --console 2>1 | findstr "my.ini"

3. If the command above brings no output, it may be needed to specify the full path to mysqld binary (found in step 1.).

4. If still no success, you may capture output of following command into text file:

$ mysqld --help --verbose

Then look for locations after the following message: “Default options are read from the following files in the given order:”

Understanding the Different Configuration files used for MySQL Server

Filed Under: mysql

Some more articles you might also be interested in …

  1. Understanding MySQL Query Cache
  2. How to configure resource groups for MySQL Server running on Linux
  3. How to Install MySQL Cluster on a single server for testing purposes
  4. Which Ports are Used by mysqld, ndb_mgmd, and ndbd/ndbmtd in a MySQL Cluster Installation
  5. Excluding a table or database from MySQL replication
  6. How to reset MySQL database root password
  7. What is the purpose of “system user” in MySQL Replication
  8. How to Change Default Character Sets in MySQL using ALTER TABLE Statement
  9. CentOS / RHEL 6 : How to Start/Stop MySQL Server (mysqld)
  10. Understanding mysqlcheck and myisamchk utilities

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary