How to find out the location of currently used MySQL configuration file in linux

前端 未结 7 566
慢半拍i
慢半拍i 2020-12-23 13:06

How do I know which configuration file is used by MySQL currently? Is there any command or something to find it out?

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 14:04

    The information you want can be found by running

    mysql --help
    

    or

    mysqld --help --verbose
    

    I tried this command on my machine:

    mysql --help | grep "Default options" -A 1
    

    And it printed out:

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

    See if that works for you.

提交回复
热议问题