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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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 mysqlcheck and myisamchk utilities
  2. Beginners Guide to MySQL Data Types
  3. How to find Which Process Is Killing mysqld With SIGKILL or SIGTERM on Linux
  4. MySQL ‘show processlist’ statement
  5. How to Generate Unique IDs For MySQL Cluster Backups
  6. How to Add New Nodes To an Existing MySQL Cluster Setup
  7. MySQL Enterprise Backup (MEB): Lock the Tables While Making the Backup?
  8. MySQL – How to undo (rollback) a set of SQL statements
  9. MySQL Grants – Setting User Permissions On Different Tables
  10. MySQL : Stored Procedure For Rotating the Audit Log

You May Also Like

Primary Sidebar

Recent Posts

  • What are /dev/zero and /dev/null files in Linux
  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright