首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mysql -要更新哪个cnf文件

Mysql -要更新哪个cnf文件
EN

Database Administration用户
提问于 2020-07-06 10:54:14
回答 1查看 846关注 0票数 1

我让mysql 8在一个ubuntu20.4服务器上运行。我想应用一些设置来优化数据库,以便它在web应用程序中使用较少的ram。典型的performance_schema切换。

我应该添加哪个cnf文件的设置?当我运行以下命令时,我得到以下信息:

代码语言:javascript
复制
$ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

/etc/my.cnf文件不存在

/etc/mysql/my.cnf包含以下内容:

代码语言:javascript
复制
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

~/.my.cnf不存在。

然后我有以下文件/etc/mysql/mysql.conf.d/mysqld.cnf

代码语言:javascript
复制
#
# The MySQL database server configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[mysqld]
#
# * Basic Settings
#
user            = mysql
# pid-file      = /var/run/mysqld/mysqld.pid
# socket        = /var/run/mysqld/mysqld.sock
# port          = 3306
# datadir       = /var/lib/mysql
...

我已经将该设置添加到/etc/mysql/mysql.conf.d/mysqld.cnf文件中,但是如果有人能够建议添加这样的设置的正确文件,则会有帮助吗?

EN

回答 1

Database Administration用户

发布于 2021-03-12 17:11:26

默认情况下,我总是在/etc/mysql/mysql.conf.d/mysqld.cnf进行更改,以避免过多地分割我的更改,尽管这两种方法都可以运行/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf,但不要忘记重新启动mysql服务。

票数 1
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/270438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档