我让mysql 8在一个ubuntu20.4服务器上运行。我想应用一些设置来优化数据库,以便它在web应用程序中使用较少的ram。典型的performance_schema切换。
我应该添加哪个cnf文件的设置?当我运行以下命令时,我得到以下信息:
$ /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包含以下内容:
#
# 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
#
# 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文件中,但是如果有人能够建议添加这样的设置的正确文件,则会有帮助吗?
发布于 2021-03-12 17:11:26
默认情况下,我总是在/etc/mysql/mysql.conf.d/mysqld.cnf进行更改,以避免过多地分割我的更改,尽管这两种方法都可以运行/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf,但不要忘记重新启动mysql服务。
https://dba.stackexchange.com/questions/270438
复制相似问题