Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

mysql - 我如何找到MySQL my.cnf位置(How do I find the MySQL my.cnf location)

是否有MySQL命令来定位my.cnf配置文件,类似于PHP的phpinfo()如何定位其php.ini

  ask by robinmag translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is no internal MySQL command to trace this, it's a little too abstract.

(没有内部MySQL命令来跟踪这个,它有点过于抽象。)

The file might be in 5 (or more?) locations, and they would all be valid because they load cascading.

(该文件可能位于5个(或更多?)位置,并且它们都有效,因为它们加载了级联。)

  • /etc/my.cnf

    (/etc/my.cnf中)

  • /etc/mysql/my.cnf

    (/etc/mysql/my.cnf)

  • $MYSQL_HOME/my.cnf

    ($ MYSQL_HOME / my.cnf中)

  • [datadir]/my.cnf

    ([DATADIR] /my.cnf)

  • ~/.my.cnf

    (?/ .my.cnf)

Those are the default locations MySQL looks at.

(这些是MySQL看到的默认位置。)

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.

(此外, - --defaults-file参数可以覆盖整个事物,所以...基本上,这是一个巨大的痛苦。)

But thanks to it being so confusing, there's a good chance it's just in /etc/my.cnf.

(但是由于它如此混乱,很有可能它只是在/etc/my.cnf中。)

(if you just want to see the values: SHOW VARIABLES , but you'll need the permissions to do so.)

((如果您只想查看值: SHOW VARIABLES ,但您需要权限才能这样做。))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...