在哪指定用于mariaDB的cnf文件?

时间:2019-02-08 12:37:47

标签: mysql mariadb

我希望将默认字符集和排序规则更改为utf8mb4,而不是latin1_swedish_ci,并很快在Change MySQL default character set to UTF-8 in my.cnf?找到了答案。

好的,应该使用哪个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_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]

0 个答案:

没有答案