Mysql 在哪里可以指定mariaDB使用哪个cnf文件?

Mysql 在哪里可以指定mariaDB使用哪个cnf文件?,mysql,mariadb,Mysql,Mariadb,我希望将默认字符集和排序规则更改为utf8mb4,而不是latin1\u-swedish\u-ci,并在中快速找到答案 好的,应该使用哪个my.cnf?MySQL附带了带有默认设置的/etc/my.cnf,但是,MariaDB似乎不是这样 阅读手册 Option File Locations on Linux, Unix, Mac On a Linux, Unix or Mac server, MariaDB looks for the MariaDB option file file in t

我希望将默认字符集和排序规则更改为
utf8mb4
,而不是
latin1\u-swedish\u-ci
,并在中快速找到答案

好的,应该使用哪个
my.cnf
?MySQL附带了带有默认设置的
/etc/my.cnf
,但是,MariaDB似乎不是这样

阅读手册

Option File Locations on Linux, Unix, Mac
On a Linux, Unix or Mac server, MariaDB looks for the MariaDB option file file in the following locations:
...    
MariaDB starting with 10.0.13
....
When SYSCONFDIR is defined (for example, in RPM packages it is /etc)

Location    Scope
SYSCONFDIR/my.cnf   Global
$MYSQL_HOME/my.cnf  Server
defaults-extra-file File specified with --defaults-extra-file=path, if any
~/.my.cnf   User

MYSQL_HOME is the environment variable containing the path to the directory holding the server-specific my.cnf file. If MYSQL_HOME is not set, and the server is started with mysqld_safe, MYSQL_HOME is set as follows:
If there is a my.cnf file in the MariaDB data directory, but not in the MariaDB base directory, MYSQL_HOME is set to the MariaDB data directory.
Else, MYSQL_HOME is set to the MariaDB base directory.
好的,它不是
SYSCONFDIR/my.cnf
就是
$MYSQL\u HOME/my.cnf
,对吗?但是这些在哪里

[michael@devserver doctrine]$ ls -l /etc/my*
-rw-r--r-- 1 root root 202 Dec 30 23:29 /etc/my.cnf

/etc/my.cnf.d:
total 12
-rw-r--r-- 1 root root  763 Dec 30 23:29 enable_encryption.preset
-rw-r--r-- 1 root root  232 Dec 30 23:29 mysql-clients.cnf
-rw-r--r-- 1 root root 1080 Dec 30 23:29 server.cnf
[michael@devserver doctrine]$ cat /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

[michael@devserver doctrine]$ cat /etc/my.cnf.d/*
#
# !include this file into your my.cnf (or any of *.cnf files in /etc/my.cnf.d)
# and it will enable data at rest encryption. This is a simple way to
# ensure that everything that can be encrypted will be and your
# data will not leak unencrypted.
#
# DO NOT EDIT THIS FILE! On MariaDB upgrades it might be replaced with a
# newer version and your edits will be lost. Instead, add your edits
# to the .cnf file after the !include directive.
#
# NOTE that you also need to install an encryption plugin for the encryption
# to work. See https://mariadb.com/kb/en/mariadb/data-at-rest-encryption/#encryption-key-management
#
[mariadb]
aria-encrypt-tables
encrypt-binlog
encrypt-tmp-disk-tables
encrypt-tmp-files
loose-innodb-encrypt-log
loose-innodb-encrypt-tables
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#

[mysql]

[mysql_upgrade]

[mysqladmin]

[mysqlbinlog]

[mysqlcheck]

[mysqldump]

[mysqlimport]

[mysqlshow]

[mysqlslap]

#
# 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.2 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.2]

[michael@devserver doctrine]$ ls -l /usr/share/mysql/
total 1272
-rwxr-xr-x 1 root root   1153 Dec 30 23:34 binary-configure
drwxr-xr-x 2 root root   4096 Jan 26 00:53 charsets
drwxr-xr-x 2 root root     23 Jan 26 00:55 czech
drwxr-xr-x 2 root root     23 Jan 26 00:55 danish
drwxr-xr-x 2 root root     23 Jan 26 00:55 dutch
drwxr-xr-x 2 root root     23 Jan 26 00:55 english
-rw-r--r-- 1 root root 541061 Dec 30 23:29 errmsg-utf8.txt
drwxr-xr-x 2 root root     23 Jan 26 00:55 estonian
-rw-r--r-- 1 root root 583827 Dec 30 23:29 fill_help_tables.sql
drwxr-xr-x 2 root root     23 Jan 26 00:55 french
drwxr-xr-x 2 root root     23 Jan 26 00:55 german
drwxr-xr-x 2 root root     23 Jan 26 00:55 greek
drwxr-xr-x 2 root root     23 Jan 26 00:55 hindi
drwxr-xr-x 2 root root     23 Jan 26 00:55 hungarian
-rw-r--r-- 1 root root  15313 Dec 30 23:29 install_spider.sql
drwxr-xr-x 2 root root     23 Jan 26 00:55 italian
drwxr-xr-x 2 root root     23 Jan 26 00:55 japanese
drwxr-xr-x 2 root root     23 Jan 26 00:55 korean
-rw-r--r-- 1 root root   1328 Dec 30 23:29 magic
-rw-r--r-- 1 root root   1627 Dec 30 23:34 maria_add_gis_sp_bootstrap.sql
-rw-r--r-- 1 root root   1649 Dec 30 23:34 maria_add_gis_sp.sql
-rw-r--r-- 1 root root   4881 Dec 30 23:34 my-huge.cnf
-rw-r--r-- 1 root root  20062 Dec 30 23:34 my-innodb-heavy-4G.cnf
-rw-r--r-- 1 root root   4868 Dec 30 23:34 my-large.cnf
-rw-r--r-- 1 root root   4882 Dec 30 23:34 my-medium.cnf
-rw-r--r-- 1 root root   2808 Dec 30 23:34 my-small.cnf
-rwxr-xr-x 1 root root   1061 Dec 30 23:34 mysqld_multi.server
-rwxr-xr-x 1 root root    868 Dec 30 23:34 mysql-log-rotate
-rw-r--r-- 1 root root   1955 Dec 30 23:29 mysql_performance_tables.sql
-rwxr-xr-x 1 root root  12113 Dec 30 23:34 mysql.server
-rw-r--r-- 1 root root   4517 Dec 30 23:29 mysql_system_tables_data.sql
-rw-r--r-- 1 root root  27622 Dec 30 23:29 mysql_system_tables.sql
-rw-r--r-- 1 root root  10411 Dec 30 23:29 mysql_test_data_timezone.sql
-rw-r--r-- 1 root root   1210 Dec 30 23:29 mysql_to_mariadb.sql
drwxr-xr-x 2 root root     23 Jan 26 00:55 norwegian
drwxr-xr-x 2 root root     23 Jan 26 00:55 norwegian-ny
drwxr-xr-x 4 root root     35 Dec 31 00:28 policy
drwxr-xr-x 2 root root     23 Jan 26 00:55 polish
drwxr-xr-x 2 root root     23 Jan 26 00:55 portuguese
drwxr-xr-x 2 root root     23 Jan 26 00:55 romanian
drwxr-xr-x 2 root root     23 Jan 26 00:55 russian
drwxr-xr-x 2 root root     23 Jan 26 00:55 serbian
drwxr-xr-x 2 root root     23 Jan 26 00:55 slovak
drwxr-xr-x 2 root root     23 Jan 26 00:55 spanish
drwxr-xr-x 2 root root     23 Jan 26 00:55 swedish
drwxr-xr-x 2 root root     62 Jan 26 00:55 systemd
drwxr-xr-x 2 root root     23 Jan 26 00:55 ukrainian
-rw-r--r-- 1 root root   3479 Dec 30 23:34 wsrep.cnf
-rwxr-xr-x 1 root root   2230 Dec 30 23:34 wsrep_notify
[michael@devserver doctrine]

查看@RaymondNijland请查看我在阅读手册的基础上所做的编辑。这是一个难题,但你可以这样做:为每个可能的my.cnf添加一个稍微不同的值;重新启动mysqld,然后执行
显示变量,如“…”
以查看输入的值。这应该是安全的:将
max_connections
更改1(每个文件)。如果默认值为151,则使用152、153等。查看@RaymondNijland请查看我在阅读手册的基础上所做的编辑。这是一个难题,但您可以这样做:为每个可能的my.cnf添加一个稍微不同的值;重新启动mysqld,然后执行
显示变量,如“…”
以查看输入的值。这应该是安全的:将
max_connections
更改1(每个文件)。如果默认值为151,则使用152、153等。