我如何找到MySQL my.cnf位置 [英] How do I find the MySQL my.cnf location
问题描述
是否有MySQL命令来定位my.cnf
配置文件,类似于PHP的phpinfo()
定位其php.ini
的方式?
Is there a MySQL command to locate the my.cnf
configuration file, similar to how PHP's phpinfo()
locates its php.ini
?
推荐答案
没有内部MySQL命令可以对此进行跟踪,这有点抽象.该文件可能位于5个(或更多?)位置,由于它们加载级联,它们都将是有效的.
There is no internal MySQL command to trace this, it's a little too abstract. The file might be in 5 (or more?) locations, and they would all be valid because they load cascading.
- /etc/my.cnf
- /etc/mysql/my.cnf
- $ MYSQL_HOME/my.cnf
- [datadir]/my.cnf
- 〜/.my.cnf
这些是MySQL查找的默认位置.如果发现多个,则将加载每个&值互相覆盖(我认为按列出的顺序).另外,--defaults-file
参数可以覆盖整个内容,所以...基本上,这是一个巨大的麻烦.
Those are the default locations MySQL looks at. If it finds more than one, it will load each of them & values override each other (in the listed order, I think). Also, the --defaults-file
parameter can override the whole thing, so... basically, it's a huge pain in the butt.
但是由于它是如此令人困惑,所以很有可能它就位于/etc/my.cnf中.
But thanks to it being so confusing, there's a good chance it's just in /etc/my.cnf.
(if you just want to see the values: SHOW VARIABLES
, but you'll need the permissions to do so.)
这篇关于我如何找到MySQL my.cnf位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!