是否有一个MySQL命令来定位my.cnf配置文件,类似于PHP的phpinfo()定位它的PHP .ini?


当前回答

对我来说,这是我有“ENGINE=MyISAM”类型的表,一旦我改变它为“ENGINE=InnoDB”它工作了:) 在PhpMyAdmin在Azure应用程序服务:)

其他回答

没有MySQL内部命令来跟踪这一点,这有点太抽象了。该文件可能位于5个(或更多)位置,并且它们都是有效的,因为它们加载级联。

/etc/my.cnf /etc/mysql/my.cnf $ MYSQL_HOME / my.cnf [datadir]。/ my . cnf中所做 ~ / .my.cnf

这些是MySQL查看的默认位置。如果它发现不止一个,它将加载它们中的每一个&值相互覆盖(在列出的顺序,我认为)。此外,——defaults-file参数可以覆盖整个内容,所以…基本上,这是一件非常痛苦的事。

但由于它太令人困惑,很有可能它只是在/etc/my.cnf.中

(如果你只是想看值:SHOW VARIABLES,但你需要权限这样做。)


运行mysql——help,你会看到:

默认选项按照指定顺序从以下文件中读取:/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

对于Ubuntu 20.04.4 LTS上的MariaDB 10.5 (Focal Fossa):

# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.

找到了我的

mysqld --help --verbose | grep my.cnf

对我来说,这是我有“ENGINE=MyISAM”类型的表,一旦我改变它为“ENGINE=InnoDB”它工作了:) 在PhpMyAdmin在Azure应用程序服务:)

你可以用find命令找到my.cnf或任何其他文件:

find / -name my.cnf (or any other file name)

Find是一条命令 /(斜杠)为路径 My.cnf是一个文件名