是否有一个MySQL命令来定位my.cnf配置文件,类似于PHP的phpinfo()定位它的PHP .ini?
当前回答
这可能有用:
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()是成功的。
其他回答
这可能有用:
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()是成功的。
没有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
如果您正在使用MAMP,请访问模板> MySQL (my.cnf) > [version]
如果您正在运行MAMP无窗口,您可能需要使用customize按钮定制工具栏。
对于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.
这取决于你的权限但对我来说 这个工作在phpmyadmin SQL控制台
显示变量;
然后改变一些变量 你可以这样做
SET GLOBAL max_connections = 1000;
or
设置@@GLOBAL。Max_connections = 1000;
试试吧
推荐文章
- 使用sudo时未找到命令
- MySQL删除表中的所有行,并将ID重置为零
- 当有命令行参数时,如何使用GDB分析程序的核心转储文件?
- 在准备语句中使用“like”通配符
- MySQL中的表名是否区分大小写?
- 库未加载:libmysqlclient.16。在OS X 10.6上使用mysql2 gem运行'rails server'时出现dylib错误
- 如何知道MySQL表最近一次更新?
- 在MySQL中的一个查询中更新多个具有不同值的行
- 如何强制从另一个SSH会话分离屏幕?
- 如果表存在则删除表并创建它,如果不存在则创建它
- 如何将文件指针(file * fp)转换为文件描述符(int fd)?
- MySQL OR与IN性能
- Linux Bash中双&和分号有什么区别?
- 将值从同一表中的一列复制到另一列
- 删除id与其他表不匹配的sql行