Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Follow to new /etc/mysql/my.cnf management scheme
Browse files Browse the repository at this point in the history
See mysql-common package changes at
basak/debian-mysql@6c0a50a
  • Loading branch information
ottok committed Feb 3, 2015
1 parent 8c26757 commit 2f0dff8
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 28 deletions.
33 changes: 12 additions & 21 deletions debian/additions/mariadb.cnf
@@ -1,24 +1,15 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf

[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
#default-character-set = utf8

[mysqld]
# The MariaDB configuration file
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
# The MariaDB/MySQL tools read configuration files in the following order:
# - "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# - "/etc/mysql/mariadb.conf.d/*.cnf" to set global options.
# - "~/.my.cnf" to set user-specific options.
#
#character-set-server = utf8
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci

# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
# If the same option is defined multiple times, the last one will apply.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add = auth_socket.so
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
3 changes: 3 additions & 0 deletions debian/additions/mariadb.conf.d/client.cnf
@@ -0,0 +1,3 @@
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8
103 changes: 103 additions & 0 deletions debian/additions/mariadb.conf.d/mysqld.cnf
@@ -0,0 +1,103 @@
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10

#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# 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.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#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

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server = utf8
collation-server = utf8_general_ci
character_set_server = utf8
collation_server = utf8_general_ci

#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add = auth_socket.so
8 changes: 8 additions & 0 deletions debian/additions/mariadb.conf.d/mysqld_safe.cnf
@@ -0,0 +1,8 @@
[mysqld_safe]
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
2 changes: 0 additions & 2 deletions debian/additions/mysqld_safe_syslog.cnf

This file was deleted.

3 changes: 2 additions & 1 deletion debian/mariadb-common.install
@@ -1 +1,2 @@
debian/additions/mariadb.cnf etc/mysql/conf.d
debian/additions/mariadb.cnf etc/mysql/
debian/additions/mariadb.conf.d etc/mysql/
30 changes: 30 additions & 0 deletions debian/mariadb-common.postinst
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

case "$1" in
configure)
# New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
# variants in Ubuntu. If the new mysql-common package does not provide
# the update-alternatives facility, fall back to creating a symlink
if [ -f /usr/share/mysql-common/configure-symlinks ]
then
/usr/share/mysql-common/configure-symlinks install mariadb "/etc/mysql/mariadb.cnf"
else
mv /etc/mysql/my.cnf /etc/mysql/my.cnf.old
ln -s /etc/mysql/mariadb.cnf /etc/mysql/my.cnf
fi
;;

abort-upgrade|abort-remove|abort-configure)
;;

*)
echo "postinst called with unknown argument '$1'" 1>&2
exit 1
;;
esac

#DEBHELPER#

exit 0
24 changes: 20 additions & 4 deletions debian/mariadb-common.postrm
Expand Up @@ -2,9 +2,25 @@

set -e

if [ "$1" = "purge" ]; then
rmdir /etc/mysql/conf.d 2>/dev/null || true
rmdir /etc/mysql 2>/dev/null || true
fi
case "$1" in
remove|disappear)
# New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
# variants in Ubuntu.
if [ -f /usr/share/mysql-common/configure-symlinks ]
then
/usr/share/mysql-common/configure-symlinks remove mariadb "/etc/mysql/mariadb.cnf"
fi
;;

purge|upgrade|failed-upgrade|abort-install|abort-upgrade)
;;

*)
echo "postrm called with unknown argument '$1'" 1>&2
exit 1
;;
esac

#DEBHELPER#

exit 0

0 comments on commit 2f0dff8

Please sign in to comment.