Skip to content
Snippets Groups Projects
Verified Commit 33555ffc authored by Michal Hrusecky's avatar Michal Hrusecky :mouse:
Browse files

mariadb: Drop patches, we are forking MariaDB package

parent c6dce849
Branches
Tags
No related merge requests found
From 5b7e67f27aa4d45681d487336ef77f00b3f1538b Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <michal.hrusecky@nic.cz>
Date: Wed, 12 Dec 2018 15:00:37 +0100
Subject: [PATCH 1/6] mariadb: Small init script polishing
Using mysqld to get datadir, tmpdir, pidfile and socketfile. This way they
don't need to be set or can be set in included configuration file. Also allows
people to override location of pid file and socket file.
Apart from that, drop pidfile created by procd and let Maria create it by
itself but start MariaDB as mysql user and install configuration files in a way
Maria can read it.
Also include fallback when logger is not available.
Signed-off-by: Michal Hrusecky Michal@Hrusecky.net
---
utils/mariadb/Makefile | 9 ++++++---
utils/mariadb/files/mysqld.init | 26 +++++++++++++++++---------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile
index b501e7e..3032a1f 100644
--- a/utils/mariadb/Makefile
+++ b/utils/mariadb/Makefile
@@ -494,10 +494,13 @@ define Package/mariadb-server/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/mysql/conf.d
$(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
- $(INSTALL_CONF) conf/my.cnf $(1)/etc/mysql
- $(INSTALL_CONF) conf/mysqld.default $(1)/etc/default/mysqld
+ # DATA because spomebody thought giving CONF 0600 rights is a good idea
+ $(INSTALL_DATA) conf/my.cnf $(1)/etc/mysql
+ # DATA because spomebody thought giving CONF 0600 rights is a good idea
+ $(INSTALL_DATA) conf/mysqld.default $(1)/etc/default/mysqld
$(INSTALL_DIR) $(1)$(PLUGIN_DIR)
- $(INSTALL_CONF) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/daemon_example.ini $(1)$(PLUGIN_DIR)
+ # DATA because spomebody thought giving CONF 0600 rights is a good idea
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/daemon_example.ini $(1)$(PLUGIN_DIR)
$(INSTALL_DIR) $(1)/usr/share/mysql/english
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql
diff --git a/utils/mariadb/files/mysqld.init b/utils/mariadb/files/mysqld.init
index abc99fc..5cdb9c6 100644
--- a/utils/mariadb/files/mysqld.init
+++ b/utils/mariadb/files/mysqld.init
@@ -12,6 +12,7 @@ MYSQLD=mysqld
DEFAULT=/etc/default/$MYSQLD
LOGGER="/usr/bin/logger -p user.err -s -t $MYSQLD"
+[ -x /usr/bin/logger ] || LOGGER=echo
PROG=/usr/bin/$MYSQLD
unset MY_ARGS MY_GROUP MY_USER
@@ -21,12 +22,18 @@ unset MY_ARGS MY_GROUP MY_USER
my_user="${MY_USER:-mariadb}"
my_group="${MY_GROUP:-mariadb}"
+mysql_get_var() {
+ /usr/bin/mysqld --help --verbose | sed -n 's|^'"$1"'[[:blank:]]\+||p'
+}
+
start_service() {
- local conf='/etc/mysql/my.cnf'
- local datadir="$( sed -nE "s/^\s*datadir\s*=\s*('([^']*)'|\x22([^\x22]*)\x22|(.*\S))\s*$/\2\3\4/p" "$conf" )"
+ local datadir="$(mysql_get_var datadir)"
+ local tmpdir="$(mysql_get_var tmpdir)"
+ local pidfile="$(mysql_get_var pid-file)"
+ local socketfile="$(mysql_get_var socket)"
[ -d "$datadir" ] || {
- $LOGGER "datadir '$datadir' in '$conf' does not exist"
+ $LOGGER "datadir '$datadir' does not exist"
return 1
}
@@ -36,18 +43,19 @@ start_service() {
return 1
}
- mkdir -p /var/lib/mysql
- chown "$my_user":"$my_group" /var/lib/mysql
-
- mkdir -p /var/run/mysqld
- chown "$my_user":"$my_group" /var/run/mysqld
+ for i in /var/lib/mysql "$tmpdir" "$(dirname "$pidfile")" "$(dirname "$socketfile")"; do
+ if [ \! -d "$i" ]; then
+ mkdir -p "$i"
+ chown "$my_user":"$my_group" "$i"
+ fi
+ done
procd_open_instance
procd_set_param command $PROG $MY_ARGS
- procd_set_param pidfile /var/run/mysqld.pid
# forward stderr to logd
procd_set_param stderr 1
+ procd_set_param user "$my_user"
procd_close_instance
}
--
2.19.2
From d50d6b7b83d6eaa35de0a3ef7e5a085d9a224bca Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <michal.hrusecky@nic.cz>
Date: Wed, 12 Dec 2018 15:02:36 +0100
Subject: [PATCH 2/6] mariadb: Drop default mariadb default file
Drop it as it is not needed and doesn't make much sense.
Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
---
utils/mariadb/Makefile | 3 ---
utils/mariadb/conf/mysqld.default | 10 ----------
utils/mariadb/files/mysqld.init | 9 ++-------
3 files changed, 2 insertions(+), 20 deletions(-)
delete mode 100644 utils/mariadb/conf/mysqld.default
diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile
index 3032a1f..6057919 100644
--- a/utils/mariadb/Makefile
+++ b/utils/mariadb/Makefile
@@ -496,8 +496,6 @@ define Package/mariadb-server/install
$(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
# DATA because spomebody thought giving CONF 0600 rights is a good idea
$(INSTALL_DATA) conf/my.cnf $(1)/etc/mysql
- # DATA because spomebody thought giving CONF 0600 rights is a good idea
- $(INSTALL_DATA) conf/mysqld.default $(1)/etc/default/mysqld
$(INSTALL_DIR) $(1)$(PLUGIN_DIR)
# DATA because spomebody thought giving CONF 0600 rights is a good idea
$(INSTALL_DATA) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/daemon_example.ini $(1)$(PLUGIN_DIR)
@@ -516,7 +514,6 @@ define Package/mariadb-server-extra/install
endef
define Package/mariadb-server/conffiles
-/etc/default/mysqld
/etc/mysql/my.cnf
$(PLUGIN_DIR)/daemon_example.ini
endef
diff --git a/utils/mariadb/conf/mysqld.default b/utils/mariadb/conf/mysqld.default
deleted file mode 100644
index fe9c698..0000000
--- a/utils/mariadb/conf/mysqld.default
+++ /dev/null
@@ -1,10 +0,0 @@
-# The user and group that will run the MySQL server. The user mariadb is
-# automatically created by the mariadb-server package, hence that is the
-# default choice.
-
-#MY_USER=mariadb
-#MY_GROUP=mariadb
-
-# Additional arguments you want to pass to the MySQL server.
-
-#MY_ARGS=""
diff --git a/utils/mariadb/files/mysqld.init b/utils/mariadb/files/mysqld.init
index 5cdb9c6..1abbf9d 100644
--- a/utils/mariadb/files/mysqld.init
+++ b/utils/mariadb/files/mysqld.init
@@ -10,17 +10,12 @@ USE_PROCD=1
MYSQLD=mysqld
-DEFAULT=/etc/default/$MYSQLD
LOGGER="/usr/bin/logger -p user.err -s -t $MYSQLD"
[ -x /usr/bin/logger ] || LOGGER=echo
PROG=/usr/bin/$MYSQLD
-unset MY_ARGS MY_GROUP MY_USER
-
-[ -f $DEFAULT ] && . $DEFAULT
-
-my_user="${MY_USER:-mariadb}"
-my_group="${MY_GROUP:-mariadb}"
+my_user="mariadb"
+my_group="mariadb"
mysql_get_var() {
/usr/bin/mysqld --help --verbose | sed -n 's|^'"$1"'[[:blank:]]\+||p'
--
2.19.2
commit 180e4ba20e1449e3f339da0da24429044a84faef
Author: Michal Hrusecky <michal.hrusecky@nic.cz>
Date: Wed Dec 12 15:08:45 2018 +0100
mariadb: Use more sane default path
Let's set default paths in a way that makes sense.
Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile
index 93d6dfe1c..be27d7670 100644
--- a/utils/mariadb/Makefile
+++ b/utils/mariadb/Makefile
@@ -33,7 +33,7 @@ PKG_BUILD_DEPENDS:=libevent2 mariadb/host
CMAKE_INSTALL:=1
-PLUGIN_DIR:=/usr/lib/mysql/plugin
+PLUGIN_DIR:=/usr/lib/mariadb/plugin
MARIADB_COMMON_DEPENDS := \
+libatomic \
@@ -181,7 +181,13 @@ include $(INCLUDE_DIR)/cmake.mk
TARGET_CFLAGS+=$(TARGET_CPPFLAGS)
define Package/mariadb/install/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin
+ if [ -f $(PKG_INSTALL_DIR)/usr/bin/$(2) ]; then\
+ $(INSTALL_DIR) $(1)/usr/bin;\
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin;\
+ else \
+ $(INSTALL_DIR) $(1)/usr/sbin;\
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(2) $(1)/usr/sbin;\
+ fi
endef
define Package/mariadb/description/Default
@@ -339,20 +345,11 @@ CMAKE_OPTIONS += \
-DDISABLE_SHARED=NO \
-DENABLED_PROFILING=OFF \
-DENABLE_STATIC_LIBS=OFF \
- -DINSTALL_DOCDIR=share/doc/mariadb \
- -DINSTALL_DOCREADMEDIR=share/doc/mariadb \
- -DINSTALL_MANDIR=share/man \
- -DINSTALL_MYSQLSHAREDIR=share/mysql \
- -DINSTALL_MYSQLTESTDIR="" \
- -DINSTALL_PLUGINDIR=lib/mysql/plugin \
- -DINSTALL_SBINDIR=bin \
- -DINSTALL_SCRIPTDIR=bin \
- -DINSTALL_SQLBENCHDIR="" \
- -DINSTALL_SUPPORTFILESDIR=share/mysql \
- -DINSTALL_UNIX_ADDRDIR=/var/run/mysqld/mysqld.sock \
- -DMYSQLD_USER=mariadb \
- -DMYSQL_DATADIR=/var/lib/mysql \
- -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb \
+ -DINSTALL_LAYOUT=RPM \
+ -DINSTALL_PLUGINDIR=lib/mariadb/plugin \
+ -DINSTALL_MYSQLDATADIR=/srv/mysql \
+ -DINSTALL_UNIX_ADDRDIR=/var/run/mysql.sock
-DSKIP_TESTS=ON \
-DWITH_ASAN=OFF \
-DWITH_EMBEDDED_SERVER=OFF \
@@ -430,25 +427,23 @@ define Host/Install
endef
define Build/InstallDev
- $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib/mysql $(1)/usr/lib/pkgconfig $(1)/usr/share/aclocal
+ $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig $(1)/usr/share/aclocal
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin
$(LN) $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin
$(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmysqlclient*.so* $(1)/usr/lib
- cd $(1)/usr/lib/mysql; $(LN) ../libmysqlclient*.so* .
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib*/libmysqlclient*.so* $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/mariadb.pc $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/mysql.m4 $(1)/usr/share/aclocal
endef
define Package/libmariadbclient/install
$(INSTALL_DIR) $(1)$(PLUGIN_DIR)
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmysqlclient*.so* $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib*/libmysqlclient*.so* $(1)/usr/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/dialog.so $(1)$(PLUGIN_DIR)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/mysql_clear_password.so $(1)$(PLUGIN_DIR)
endef
define Package/mariadb-client/install
- $(INSTALL_DIR) $(1)/usr/bin
$(foreach b,$(MARIADB_CLIENT),$(call Package/mariadb/install/bin,$(1),$(b));)
# Install convenience links for mysqlcheck multi-call binary
cd $(1)/usr/bin; $(LN) mysqlcheck mysqlanalyze
@@ -457,43 +452,39 @@ define Package/mariadb-client/install
endef
define Package/mariadb-client-extra/install
- $(INSTALL_DIR) $(1)/usr/bin
$(foreach b,$(MARIADB_CLIENT_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
endef
define Package/mariadb-extra-charsets/install
- $(INSTALL_DIR) $(1)/usr/share/mysql/charsets
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/charsets/* $(1)/usr/share/mysql/charsets
+ $(INSTALL_DIR) $(1)/usr/share/mariadb/charsets
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/charsets/* $(1)/usr/share/mariadb/charsets
endef
define Package/mariadb-server/install
- $(INSTALL_DIR) $(1)/usr/bin
$(foreach b,$(MARIADB_SERVER),$(call Package/mariadb/install/bin,$(1),$(b));)
$(INSTALL_DIR) $(1)/etc/default
$(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_DIR) $(1)/etc/mysql/conf.d
$(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
# DATA because spomebody thought giving CONF 0600 rights is a good idea
- $(INSTALL_DATA) conf/my.cnf $(1)/etc/mysql
+ $(INSTALL_DATA) files/my.cnf $(1)/etc/mysql
$(INSTALL_DIR) $(1)$(PLUGIN_DIR)
# DATA because spomebody thought giving CONF 0600 rights is a good idea
$(INSTALL_DATA) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/daemon_example.ini $(1)$(PLUGIN_DIR)
- $(INSTALL_DIR) $(1)/usr/share/mysql/english
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/maria_add_gis_sp_bootstrap.sql $(1)/usr/share/mysql
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_performance_tables.sql $(1)/usr/share/mysql
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql
+ $(INSTALL_DIR) $(1)/usr/share/mariadb/english
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/english/errmsg.sys $(1)/usr/share/mariadb/english
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/fill_help_tables.sql $(1)/usr/share/mariadb
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/maria_add_gis_sp_bootstrap.sql $(1)/usr/share/mariadb
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/mysql_performance_tables.sql $(1)/usr/share/mariadb
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/mysql_system_tables.sql $(1)/usr/share/mariadb
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mariadb/mysql_system_tables_data.sql $(1)/usr/share/mariadb
endef
define Package/mariadb-server-extra/install
- $(INSTALL_DIR) $(1)/usr/bin
$(foreach b,$(MARIADB_SERVER_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
endef
define Package/mariadb-server/conffiles
-/etc/mysql/my.cnf
+/etc/my.cnf
$(PLUGIN_DIR)/daemon_example.ini
endef
From 5de704bed4b2aef9e091d4a64ff6dfba7fde12d6 Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <michal.hrusecky@nic.cz>
Date: Wed, 12 Dec 2018 15:11:36 +0100
Subject: [PATCH 4/6] mariadb: Use backward compatible mysql user
To make migration smooth, use mysql user that used to be around.
Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
---
utils/mariadb/Makefile | 2 +-
utils/mariadb/files/mysqld.init | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile
index f5b5abb..68c5a87 100644
--- a/utils/mariadb/Makefile
+++ b/utils/mariadb/Makefile
@@ -271,7 +271,7 @@ define Package/mariadb-server
TITLE:=MariaDB database core server binaries
MENU:=1
PROVIDES:=mysql-server
- USERID:=mariadb=376:mariadb=376
+ USERID:=mysql=6446:mysql=6446
endef
define Package/mariadb-server/description
diff --git a/utils/mariadb/files/mysqld.init b/utils/mariadb/files/mysqld.init
index 1abbf9d..e9fe7ee 100644
--- a/utils/mariadb/files/mysqld.init
+++ b/utils/mariadb/files/mysqld.init
@@ -14,8 +14,8 @@ LOGGER="/usr/bin/logger -p user.err -s -t $MYSQLD"
[ -x /usr/bin/logger ] || LOGGER=echo
PROG=/usr/bin/$MYSQLD
-my_user="mariadb"
-my_group="mariadb"
+my_user="mysql"
+my_group="mysql"
mysql_get_var() {
/usr/bin/mysqld --help --verbose | sed -n 's|^'"$1"'[[:blank:]]\+||p'
--
2.19.2
From 5e64abd772ad7ff6c5c82cdb5011f75cfc590935 Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <michal.hrusecky@nic.cz>
Date: Wed, 12 Dec 2018 15:16:21 +0100
Subject: [PATCH 5/6] mariadb: Better integration
Provide automatic database creation and automatic migration from the old
version.
Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
---
utils/mariadb/files/mysqld.init | 41 +++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/utils/mariadb/files/mysqld.init b/utils/mariadb/files/mysqld.init
index e9fe7ee..175198b 100644
--- a/utils/mariadb/files/mysqld.init
+++ b/utils/mariadb/files/mysqld.init
@@ -26,17 +26,13 @@ start_service() {
local tmpdir="$(mysql_get_var tmpdir)"
local pidfile="$(mysql_get_var pid-file)"
local socketfile="$(mysql_get_var socket)"
+ local version="$(mysqld --version | sed -n 's|.*Ver[[:blank:]]*\([0-9.]*\)-.*|\1|p')"
- [ -d "$datadir" ] || {
- $LOGGER "datadir '$datadir' does not exist"
- return 1
- }
-
- [ -f "$datadir/mysql/tables_priv.MYD" ] || {
- $LOGGER "cannot detect privileges table, you might need to"
- $LOGGER "run 'mysql_install_db --force' to initialize the system tables"
- return 1
- }
+ # Auto installation
+ if [ \! -d "$datadir" ]; then
+ mysql_install_db --skip-auth-anonymous-user --user=mysql --skip-name-resolve
+ echo "$version" > "$datadir"/.version
+ fi
for i in /var/lib/mysql "$tmpdir" "$(dirname "$pidfile")" "$(dirname "$socketfile")"; do
if [ \! -d "$i" ]; then
@@ -45,9 +41,34 @@ start_service() {
fi
done
+ # Migration from old versions
+ if [ "`cat "$datadir"/.version 2> /dev/null`" \!= "$version" ]; then
+ sudo -u mysql mysqld --skip-networking --skip-grant-tables --socket=/tmp/mysql_upgrade.sock &
+ PID="$!"
+ i=0
+ while [ "$i" -lt 15 ] && [ \! -S /tmp/mysql_upgrade.sock ]; do
+ sleep 1
+ i="`expr $i + 1`"
+ done
+ [ -S /tmp/mysql_upgrade.sock ] || exit 1
+ mysql_upgrade --upgrade-system-tables --socket=/tmp/mysql_upgrade.sock
+ echo "$version" > "$datadir"/.version
+ kill "$PID"
+ i=0
+ while [ "$i" -lt 60 ] && [ -n "`grep mysql /proc/$PID/cmdline 2> /dev/null`" ]; do
+ sleep 1
+ [ "$i" -lt 30 ] || kill "$PID"
+ i="`expr $i + 1`"
+ done
+ if [ -n "`grep mysql /proc/$PID/cmdline 2> /dev/null`" ]; then
+ kill -9 "$PID"
+ fi
+ fi
+
procd_open_instance
procd_set_param command $PROG $MY_ARGS
+ procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
# forward stderr to logd
procd_set_param stderr 1
procd_set_param user "$my_user"
--
2.19.2
From ed1b74c1de9b67dff68b95b094efea1e8704f8fc Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <michal.hrusecky@nic.cz>
Date: Wed, 12 Dec 2018 15:26:19 +0100
Subject: [PATCH 6/6] mariadb: Tweak default configuration file
Use more fitted defaults, basically aiming at Nextcloud usecase.
Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
---
utils/mariadb/conf/my.cnf | 54 --------------------
utils/mariadb/files/my.cnf | 101 +++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+), 54 deletions(-)
delete mode 100644 utils/mariadb/conf/my.cnf
create mode 100644 utils/mariadb/files/my.cnf
diff --git a/utils/mariadb/conf/my.cnf b/utils/mariadb/conf/my.cnf
deleted file mode 100644
index effa88a..0000000
--- a/utils/mariadb/conf/my.cnf
+++ /dev/null
@@ -1,54 +0,0 @@
-[client]
-port = 3306
-socket = /var/run/mysqld/mysqld.sock
-
-[mysqld]
-user = mariadb
-socket = /var/run/mysqld/mysqld.sock
-port = 3306
-basedir = /usr
-
-############ Don't put this on the NAND #############
-# Figure out where you are going to put the databases
-# And run mysql_install_db --force
-datadir = /mnt/data/mysql/
-
-######### This should also not go on the NAND #######
-tmpdir = /mnt/data/tmp/
-
-skip-external-locking
-
-bind-address = 127.0.0.1
-
-# Fine Tuning
-key_buffer_size = 16M
-max_allowed_packet = 16M
-thread_stack = 192K
-thread_cache_size = 8
-
-# Here you can see queries with especially long duration
-#log_slow_queries = /var/log/mysql/mysql-slow.log
-#long_query_time = 2
-#log-queries-not-using-indexes
-
-# The following can be used as easy to replay backup logs or for replication.
-#server-id = 1
-#log_bin = /var/log/mysql/mysql-bin.log
-#expire_logs_days = 10
-#max_binlog_size = 100M
-#binlog_do_db = include_database_name
-#binlog_ignore_db = include_database_name
-
-
-[mysqldump]
-quick
-quote-names
-max_allowed_packet = 16M
-
-[mysql]
-#no-auto-rehash # faster start of mysql but no tab completition
-
-[isamchk]
-key_buffer = 16M
-
-
diff --git a/utils/mariadb/files/my.cnf b/utils/mariadb/files/my.cnf
new file mode 100644
index 0000000..5960e64
--- /dev/null
+++ b/utils/mariadb/files/my.cnf
@@ -0,0 +1,101 @@
+# Example MySQL config file for small systems.
+#
+# This is for a system with little memory (<= 64M) where MySQL is only used
+# from time to time and it's important that the mysqld daemon
+# doesn't use much resources.
+#
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+[client]
+#password = your_password
+port = 3306
+socket = /var/run/mysql.sock
+default-character-set = utf8mb4
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+bind-address = 127.0.0.1
+port = 3306
+socket = /var/run/mysql.sock
+skip-external-locking
+max_allowed_packet = 64M
+transaction_isolation = READ-COMMITTED
+skip-name-resolve
+query_cache_type = 1
+query_cache_limit = 1M
+query_cache_min_res_unit = 1k
+query_cache_size = 32M
+tmp_table_size= 32M
+max_heap_table_size= 32M
+character-set-server = utf8mb4
+collation-server = utf8mb4_general_ci
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (using the "enable-named-pipe" option) will render mysqld useless!
+#
+#skip-networking
+server-id = 1
+
+# Uncomment the following if you want to log updates
+#log-bin=mysql-bin
+
+# binary logging format - mixed recommended
+#binlog_format=mixed
+
+# Causes updates to non-transactional engines using statement format to be
+# written directly to binary log. Before using this option make sure that
+# there are no dependencies between transactional and non-transactional
+# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
+# t_innodb; otherwise, slaves may diverge from the master.
+#binlog_direct_non_transactional_updates=TRUE
+
+# Additional InnoDB tweaks
+innodb_large_prefix=true
+innodb_file_format=barracuda
+innodb_file_per_table=1
+innodb_buffer_pool_size = 64M
+innodb_buffer_pool_instances = 1
+innodb_flush_log_at_trx_commit = 2
+innodb_log_buffer_size = 32M
+innodb_max_dirty_pages_pct = 90
+#innodb_data_home_dir = /srv/mysql
+#innodb_data_file_path = ibdata1:10M:autoextend
+#innodb_log_group_home_dir = /srv/mysql
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+#innodb_buffer_pool_size = 16M
+# Set .._log_file_size to 25 % of buffer pool size
+#innodb_log_file_size = 5M
+#innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+#innodb_lock_wait_timeout = 50
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 8M
+sort_buffer_size = 8M
+
+[mysqlhotcopy]
+interactive-timeout
--
2.19.2
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment