是否有一个MySQL命令来定位my.cnf配置文件,类似于PHP的phpinfo()定位它的PHP .ini?
当前回答
你必须根据你的MySQL版本查找不同的位置。
mysqld --help -verbose | grep my.cnf
For Homebrew:
/usr/local/Cellar/mysql/8.0.11/bin/mysqld (mysqld 8.0.11)
Default possible locations:
/etc/my.cnf
/etc/mysql/my.cnf
~/.my.cnf
Found mine here:
/usr/local/etc/my.cnf
其他回答
MySQL配置文件:
/etc/my.cnf
所有很棒的建议,在我的情况下,我没有在任何这些位置找到它,但在/usr/share/mysql,我有一个RHEL虚拟机,我安装了mysql5.5
try
mysql --verbose --help | grep -A 1 "Default options"
我不知道你是如何在Linux环境下安装MySQL的,但你检查过吗?
/etc/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.
推荐文章
- 使用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行