Skip to content

Commit 24edbcf

Browse files
authored
Merge pull request #119 from linuxserver/my-cnf
Update my.cnf
2 parents e34e1d7 + 125a2d7 commit 24edbcf

File tree

4 files changed

+200
-152
lines changed

4 files changed

+200
-152
lines changed

readme-vars.yml

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ app_setup_block: |
104104
105105
# changelog
106106
changelogs:
107+
- { date: "04.02.23:", desc: "Minor updates to defaults in custom.cnf." }
107108
- { date: "31.01.23:", desc: "Rebase to 3.17." }
108109
- { date: "09.12.22:", desc: "Add upgrade check warning." }
109110
- { date: "11.10.22:", desc: "Rebase master to Alpine 3.16, migrate to s6v3, remove password escape logic which caused problems for a small subset of users." }

root/defaults/custom.cnf

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
## custom configuration file based on https://github.com/just-containers/mariadb/blob/master/rootfs/etc/mysql/my.cnf
2+
## please be aware that changing options here may break things
3+
#
4+
# The MySQL database server configuration file.
5+
#
6+
# One can use all long options that the program supports.
7+
# Run program with --help to get a list of available options and with
8+
# --print-defaults to see which it would actually understand and use.
9+
#
10+
# For explanations see
11+
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
12+
13+
# This will be passed to all mysql clients
14+
# It has been reported that passwords should be enclosed with ticks/quotes
15+
# especially if they contain "#" chars...
16+
[client]
17+
port = 3306
18+
socket = /var/run/mysqld/mysqld.sock
19+
20+
default-character-set = utf8mb4
21+
22+
# Here is entries for some specific programs
23+
# The following values assume you have at least 32M ram
24+
25+
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
26+
[mysqld_safe]
27+
socket = /var/run/mysqld/mysqld.sock
28+
nice = 0
29+
30+
[mysqld]
31+
#
32+
# * Basic Settings
33+
#
34+
user = abc
35+
pid-file = /var/run/mysqld/mysqld.pid
36+
socket = /var/run/mysqld/mysqld.sock
37+
port = 3306
38+
basedir = /usr
39+
datadir = /var/lib/mysql
40+
tmpdir = /tmp
41+
lc_messages_dir = /usr/share/mysql
42+
lc_messages = en_US
43+
skip-external-locking
44+
#
45+
# Instead of skip-networking the default is now to listen only on
46+
# localhost which is more compatible and is not less secure.
47+
#bind-address = 127.0.0.1
48+
#
49+
# * Fine Tuning
50+
#
51+
key_buffer_size = 128M
52+
max_connections = 100
53+
connect_timeout = 5
54+
wait_timeout = 600
55+
max_allowed_packet = 16M
56+
thread_cache_size = 128
57+
thread_stack = 192K
58+
sort_buffer_size = 4M
59+
bulk_insert_buffer_size = 16M
60+
tmp_table_size = 32M
61+
max_heap_table_size = 32M
62+
63+
#performance_schema = on
64+
character_set_server = utf8mb4
65+
collation_server = utf8mb4_general_ci
66+
transaction_isolation = READ-COMMITTED
67+
binlog_format = MIXED
68+
69+
#
70+
# * MyISAM
71+
#
72+
# This replaces the startup script and checks MyISAM tables if needed
73+
# the first time they are touched. On error, make copy and try a repair.
74+
myisam_recover = BACKUP
75+
#open-files-limit = 2000
76+
table_open_cache = 400
77+
#table_cache = 64
78+
#thread_concurrency = 10
79+
myisam_sort_buffer_size = 512M
80+
concurrent_insert = 2
81+
read_buffer_size = 2M
82+
read_rnd_buffer_size = 1M
83+
#
84+
# * Query Cache Configuration
85+
#
86+
# Cache only tiny result sets, so we can fit more in the query cache.
87+
query_cache_limit = 128K
88+
query_cache_size = 64M
89+
# for more write intensive setups, set to DEMAND or OFF
90+
query_cache_type = DEMAND
91+
#
92+
# * Logging and Replication
93+
#
94+
console = 1
95+
# Both location gets rotated by the cronjob.
96+
# Be aware that this log type is a performance killer.
97+
# As of 5.1 you can enable the log at runtime!
98+
#general_log = 1
99+
#general_log_file = /config/log/mysql/mysql.log
100+
#
101+
# Error log - should be very few entries.
102+
#
103+
log_warnings = 2
104+
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf
105+
#log_error = /config/log/mysql/mysql.log
106+
#
107+
# Enable the slow query log to see queries with especially long duration
108+
slow_query_log = 1
109+
slow_query_log_file = /config/log/mysql/mariadb-slow.log
110+
long_query_time = 5
111+
#log_slow_rate_limit = 1000
112+
#log-queries-not-using-indexes
113+
#log_slow_admin_statements
114+
#
115+
# The following can be used as easy to replay backup logs or for replication.
116+
# note: if you are setting up a replication slave, see
117+
# https://mariadb.com/kb/en/setting-up-replication/
118+
# about other settings you may need to change.
119+
#server-id = 1
120+
#report_host = master1
121+
#auto_increment_increment = 2
122+
#auto_increment_offset = 1
123+
log_bin = /config/log/mysql/mariadb-bin
124+
log_bin_index = /config/log/mysql/mariadb-bin.index
125+
# not fab for performance, but safer
126+
#sync_binlog = 1
127+
#binlog_do_db = include_database_name
128+
#binlog_ignore_db = include_database_name
129+
expire_logs_days = 10
130+
max_binlog_size = 100M
131+
# slaves
132+
#relay_log = /config/log/mysql/relay-bin
133+
#relay_log_index = /config/log/mysql/relay-bin.index
134+
#relay_log_info_file = /config/log/mysql/relay-bin.info
135+
#log_slave_updates
136+
#read_only
137+
#
138+
# If applications support it, this stricter sql_mode prevents some
139+
# mistakes like inserting invalid dates etc.
140+
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
141+
#
142+
# * InnoDB
143+
#
144+
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
145+
# Read the manual for more InnoDB related options. There are many!
146+
default_storage_engine = InnoDB
147+
# you can't just change log file size, requires special procedure
148+
#innodb_log_file_size = 50M
149+
innodb_buffer_pool_size = 256M
150+
innodb_log_buffer_size = 8M
151+
innodb_file_per_table = 1
152+
innodb_open_files = 400
153+
innodb_io_capacity = 400
154+
innodb_flush_method = O_DIRECT
155+
#
156+
# * Security Features
157+
#
158+
# Read the manual, too, if you want chroot!
159+
# chroot = /var/lib/mysql/
160+
#
161+
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
162+
#
163+
# ssl-ca=/etc/mysql/cacert.pem
164+
# ssl-cert=/etc/mysql/server-cert.pem
165+
# ssl-key=/etc/mysql/server-key.pem
166+
167+
[mysqldump]
168+
quick
169+
quote-names
170+
max_allowed_packet = 16M
171+
172+
[mysql]
173+
#no-auto-rehash # faster start of mysql but no tab completion
174+
175+
[isamchk]
176+
key_buffer = 16M
177+
178+
#
179+
# * Galera-related settings
180+
#
181+
[galera]
182+
# Mandatory settings
183+
#wsrep_on=ON
184+
#wsrep_provider=
185+
#wsrep_cluster_address=
186+
#binlog_format=MIXED
187+
#default_storage_engine=InnoDB
188+
#innodb_autoinc_lock_mode=2
189+
#
190+
# Allow server to accept connections on all interfaces.
191+
#
192+
#bind-address=0.0.0.0
193+
#
194+
# Optional setting
195+
#wsrep_slave_threads=1
196+
#innodb_flush_log_at_trx_commit=0

root/defaults/my.cnf

-141
This file was deleted.

root/etc/s6-overlay/s6-rc.d/init-mariadb-config/run

+3-11
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@ mkdir -p \
1111
sed -i "s|.*skip-networking.*|#skip-networking|g" /etc/my.cnf.d/mariadb-server.cnf
1212

1313
# setup custom cnf file
14-
if [[ ! -f /config/custom.cnf ]]; then
15-
cp /defaults/my.cnf /config/custom.cnf
16-
fi
17-
18-
if [[ ! -L /etc/my.cnf.d/custom.cnf && -f /etc/my.cnf.d/custom.cnf ]]; then
19-
rm /etc/my.cnf.d/custom.cnf
20-
fi
21-
22-
if [[ ! -L /etc/my.cnf.d/custom.cnf ]]; then
23-
ln -s /config/custom.cnf /etc/my.cnf.d/custom.cnf
24-
fi
14+
cp -n /defaults/custom.cnf /config/custom.cnf
15+
rm -rf /etc/my.cnf.d/custom.cnf
16+
ln -s /config/custom.cnf /etc/my.cnf.d/custom.cnf
2517

2618
# set permissions
2719
chmod -R 777 \

0 commit comments

Comments
 (0)