我需要一些帮助来编辑正确的文件。我喜欢添加“skip-name-resolve=1”到my.cnf文件。我正在使用centos7和mariadb 10.5。
我在/etc/my. cnf中找到一个文件,内容如下:
[mysqld]
bind-address = ::ffff:127.0.0.1
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
我挣扎与最后一行“!includedir /etc/my.cnf.d”和excamation标记。在文件夹my.cnf.d我有这些文件:
-rw-r--r-- 1 root root 295 Nov 2 12:37 client.cnf
-rw-r--r-- 1 root root 763 Nov 2 12:37 enable_encryption.preset
-rw-r--r-- 1 root root 232 Nov 2 12:37 mysql-clients.cnf
-rw-r--r-- 1 root root 157 Nov 1 21:13 plesk-utf8mb4.cnf
-rw-r--r-- 1 root root 1080 Nov 2 12:37 server.cnf
-rw-r--r-- 1 root root 120 Nov 2 12:37 spider.cnf
我是否需要将“skip-name-resolve=1”添加到服务器.cnf中,因为该文件位于includedir中?或者我是否需要将其添加到我的.cnf中的socket=...行之后?
因为在server.cnf中也有[mysqld]。
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.5]
2条答案
按热度按时间kmpatx3s1#
ps -ef|grep mysql
现在可以查看正在使用的my.cnf文件。
2.停止数据库服务并向vi my.cnf添加参数。
skip-name-resolve
3.启动数据库进行测试。
nwwlzxa72#
为了便于组织,请将其放在server.cnf文件中。
配置文件按特定顺序读取,从/etc/my.cnf向下到您的用户~/. my. cnf。有关您的操作系统的当前顺序,请参阅此MariaDB文档。MySQL/MariaDB将在按顺序读取这些配置文件时读取最后设置的值。
includedir下的文件按字母顺序读取。
您还可以打印配置值,以查看您的配置文件集正在设置什么。