• 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. Configuring mysqld to log slow queries
  2. Configure MySQL Router to Auto Restart of Failure using systemd
  3. How to reset MySQL database root password
  4. How to Add Data Nodes to MySQL Cluster without Restarting the Cluster (version 6.4 and later)
  5. Understanding MySQL Query Cache
  6. “Access denied for user ‘username’@’hostname’ (using password: YES)” – Error while connecting MySQL with PHP
  7. How To Start And Stop MySQL Cluster
  8. Understanding the REVOKE statement in MySQL
  9. How to set the default character set in MySQL and how to propagate it in a master-master replication scenario
  10. MySQL – How to Set Maximum Rates for Connections and Queries

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright