是否有一个MySQL命令来定位my.cnf配置文件,类似于PHP的phpinfo()定位它的PHP .ini?
当前回答
你可以使用:
locate my.cnf
whereis my.cnf
find . -name my.cnf
其他回答
MySQL配置文件:
/etc/my.cnf
如果你用的是安装了Homebrew的Mac电脑,那就用吧
编译mysql信息
你会看到
$ brew info mysql
mysql: stable 5.6.13 (bottled)
http://dev.mysql.com/doc/refman/5.6/en/
Conflicts with: mariadb, mysql-cluster, percona-server
/usr/local/Cellar/mysql/5.6.13 (9381 files, 354M) *
最后一行是MySQL文档中的INSTALLERDIR
你可以使用:
locate my.cnf
whereis my.cnf
find . -name my.cnf
这可能有用:
strace mysql ";" 2>&1 | grep cnf
在我的机器上输出:
stat64("/etc/my.cnf", 0xbf9faafc) = -1 ENOENT (No such file or directory)
stat64("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=4271, ...}) = 0
open("/etc/mysql/my.cnf", O_RDONLY|O_LARGEFILE) = 3
read(3, "# /etc/mysql/my.cnf: The global "..., 4096) = 4096
stat64("/home/xxxxx/.my.cnf", 0xbf9faafc) = -1 ENOENT (No such file or directory)
因此,看起来/etc/mysql/my.cnf是一个,因为它的stat64()和read()是成功的。
另一个选项是使用whereis命令。
例如:my.cnf在哪里