简体   繁体   English

如何确定正在使用哪个my.cnf mysql

[英]How to determine which my.cnf mysql is using

Is there a way I can figure out which my.cnf mysql is currently using? 有没有办法可以确定当前正在使用哪个my.cnf mysql? The reason is because it's using the correct socket file to connect, but I can't figure out exactly which (if any) my.cnf it's using or trying to use so I can manually set the correct path on my local machine. 原因是因为它使用了正确的套接字文件进行连接,但是我无法确切知道它正在使用或尝试使用哪个(如果有)my.cnf,因此可以在本地计算机上手动设置正确的路径。

$ strace -f -e trace=open mysql 2>&1 | grep $SEARCH_STRING

where usually SEARCH_STRING='cnf' or SEARCH_STRING='ini' 通常SEARCH_STRING ='cnf'或SEARCH_STRING ='ini'

The default extentions for the mysql configuration file are '.cnf' and '.ini' (see http://dev.mysql.com/doc/refman/5.1/en/option-files.html ) mysql配置文件的默认扩展名是'.cnf'和'.ini'(请参阅http://dev.mysql.com/doc/refman/5.1/en/option-files.html

A bit hackish: 有点骇人听闻:

$ strace mysql 2>&1  | grep 'open' | grep '.cnf'
open("/etc/mysql/my.cnf", O_RDONLY|O_LARGEFILE) = 3
open("/home/reto/.my.cnf", O_RDONLY|O_LARGEFILE) = 3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM