summaryrefslogtreecommitdiffstats
path: root/support-files
diff options
context:
space:
mode:
Diffstat (limited to 'support-files')
-rw-r--r--support-files/CMakeLists.txt213
-rw-r--r--support-files/MacOSX/Description.plist.sh31
-rw-r--r--support-files/MacOSX/Info.plist.sh51
-rwxr-xr-xsupport-files/MacOSX/MySQLCOM70
-rw-r--r--support-files/MacOSX/ReadMe.txt378
-rw-r--r--support-files/MacOSX/StartupItem.Description.plist32
-rw-r--r--support-files/MacOSX/StartupItem.Info.plist55
-rwxr-xr-xsupport-files/MacOSX/StartupItem.postinstall53
-rw-r--r--support-files/MacOSX/StartupParameters.plist.sh36
-rwxr-xr-xsupport-files/MacOSX/mwar-wrapper32
-rwxr-xr-xsupport-files/MacOSX/mwcc-wrapper64
-rw-r--r--support-files/MacOSX/postflight.sh40
-rw-r--r--support-files/MacOSX/preflight.sh37
-rw-r--r--support-files/binary-configure.sh48
-rwxr-xr-xsupport-files/build-tags16
-rw-r--r--support-files/ccfilter119
-rw-r--r--support-files/compiler_warnings.supp225
-rw-r--r--support-files/db.opt2
-rw-r--r--support-files/dtrace/locktime.d65
-rw-r--r--support-files/dtrace/query-execandqc.d52
-rw-r--r--support-files/dtrace/query-filesort-time.d63
-rw-r--r--support-files/dtrace/query-network-time.d79
-rw-r--r--support-files/dtrace/query-parse-time.d39
-rw-r--r--support-files/dtrace/query-rowops.d82
-rw-r--r--support-files/dtrace/query-time.d41
-rw-r--r--support-files/dtrace/statement-time.d61
-rw-r--r--support-files/dtrace/statement-type-aggregate.d62
-rw-r--r--support-files/magic26
-rw-r--r--support-files/mariadb.pc.in24
-rw-r--r--support-files/mariadb.service.in169
-rw-r--r--support-files/mariadb@.service.in294
-rw-r--r--support-files/mysql-log-rotate.sh37
-rw-r--r--support-files/mysql-multi.server.sh192
-rw-r--r--support-files/mysql.m4109
-rw-r--r--support-files/mysql.server-sys5.sh86
-rw-r--r--support-files/mysql.server.sh457
-rw-r--r--support-files/mysqld_multi.server.sh60
-rw-r--r--support-files/policy/apparmor/README5
-rw-r--r--support-files/policy/apparmor/usr.sbin.mysqld151
-rw-r--r--support-files/policy/apparmor/usr.sbin.mysqld.local4
-rw-r--r--support-files/policy/selinux/README20
-rw-r--r--support-files/policy/selinux/mariadb-server.fc10
-rw-r--r--support-files/policy/selinux/mariadb-server.te99
-rw-r--r--support-files/policy/selinux/mariadb.te9
-rw-r--r--support-files/rpm/client.cnf13
-rw-r--r--support-files/rpm/enable_encryption.preset20
-rw-r--r--support-files/rpm/my.cnf11
-rw-r--r--support-files/rpm/mysql-clients.cnf23
-rw-r--r--support-files/rpm/plugin-postin.sh3
-rw-r--r--support-files/rpm/server-postin.sh87
-rw-r--r--support-files/rpm/server-posttrans.sh15
-rw-r--r--support-files/rpm/server-postun.sh12
-rw-r--r--support-files/rpm/server-prein.sh67
-rw-r--r--support-files/rpm/server-preun.sh18
-rw-r--r--support-files/rpm/server.cnf46
-rw-r--r--support-files/rpm/shared-post.sh1
-rw-r--r--support-files/sysusers.conf.in1
-rw-r--r--support-files/tmpfiles.conf.in1
-rw-r--r--support-files/use_galera_new_cluster.conf27
-rw-r--r--support-files/wsrep.cnf.sh125
-rw-r--r--support-files/wsrep_notify.sh102
61 files changed, 4370 insertions, 0 deletions
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
new file mode 100644
index 00000000..8ca2ccdb
--- /dev/null
+++ b/support-files/CMakeLists.txt
@@ -0,0 +1,213 @@
+# Copyright (c) 2006, 2016, Oracle and/or its affiliates.
+# Copyright (c) 2012, 2017, MariaDB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+
+IF(WIN32)
+ SET(localstatedir "C:\\\\mysql\\\\data\\\\")
+ SET(ini_file_extension "ini")
+ELSE()
+ SET(localstatedir "${MYSQL_DATADIR}")
+ SET(prefix "${CMAKE_INSTALL_PREFIX}")
+ SET(libexecdir ${INSTALL_SBINDIRABS})
+ SET(bindir ${INSTALL_BINDIRABS})
+ SET(sbindir "${libexecdir}")
+ SET(datadir "${MYSQL_DATADIR}")
+ SET(CC ${CMAKE_C_COMPILER})
+ SET(CXX ${CMAKE_CXX_COMPILER})
+ SET(CFLAGS ${CMAKE_C_FLAGS})
+ SET(CXXFLAGS ${CMAKE_CXX_FLAGS})
+ SET(MYSQLD_USER "mysql")
+ SET(ini_file_extension "cnf")
+ SET(HOSTNAME "uname -n")
+ENDIF()
+
+# XXX: shouldn't we just have variables for all this stuff and centralise
+# XXX: their configuration in install_layout.cmake?
+IF(WIN32)
+ SET(inst_location ${INSTALL_DOCREADMEDIR})
+ELSE()
+ SET(inst_location ${INSTALL_SUPPORTFILESDIR})
+ENDIF()
+
+IF(WITH_WSREP)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep.cnf.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/wsrep.${ini_file_extension} @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wsrep.${ini_file_extension}
+ DESTINATION ${inst_location} COMPONENT IniFiles)
+ENDIF()
+
+IF(UNIX)
+ SET(prefix ${CMAKE_INSTALL_PREFIX})
+ FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure wsrep_notify)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY )
+ INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${script}
+ DESTINATION ${inst_location} COMPONENT Server_Scripts)
+ ENDFOREACH()
+
+ IF(INSTALL_SUPPORTFILESDIR)
+ INSTALL(FILES magic DESTINATION ${inst_location} COMPONENT SupportFiles)
+ INSTALL(DIRECTORY policy DESTINATION ${inst_location} COMPONENT SupportFiles)
+ FIND_PROGRAM(CHECKMODULE checkmodule)
+ FIND_PROGRAM(SEMODULE_PACKAGE semodule_package)
+ MARK_AS_ADVANCED(CHECKMODULE SEMODULE_PACKAGE)
+
+ # Build pp files in policy/selinux
+ IF(CHECKMODULE AND SEMODULE_PACKAGE)
+ FOREACH(pol mariadb)
+ SET(src ${CMAKE_CURRENT_SOURCE_DIR}/policy/selinux/${pol}.te)
+ SET(tmp ${CMAKE_CURRENT_BINARY_DIR}/${pol}.mod)
+ SET(out ${CMAKE_CURRENT_BINARY_DIR}/${pol}.pp)
+ ADD_CUSTOM_COMMAND(OUTPUT ${out}
+ COMMAND ${CHECKMODULE} -M -m ${src} -o ${tmp}
+ COMMAND ${SEMODULE_PACKAGE} -m ${tmp} -o ${out}
+ COMMAND ${CMAKE_COMMAND} -E remove ${tmp}
+ DEPENDS ${src})
+ ADD_CUSTOM_TARGET(${pol}-pp ALL DEPENDS ${out})
+ INSTALL(FILES ${out} DESTINATION ${inst_location}/policy/selinux COMPONENT SupportFiles)
+ ENDFOREACH()
+ IF(RPM)
+ EXECUTE_PROCESS(COMMAND rpm -q --qf "%{VERSION}" libsepol
+ OUTPUT_VARIABLE LIBSEPOL_VERSION RESULT_VARIABLE err)
+ IF (NOT err)
+ SET(CPACK_RPM_server_PACKAGE_REQUIRES
+ "${CPACK_RPM_server_PACKAGE_REQUIRES} libsepol >= ${LIBSEPOL_VERSION}"
+ PARENT_SCOPE)
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_LIBDIR}/pkgconfig COMPONENT Development)
+
+ INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
+
+ SET(bindir ${INSTALL_BINDIRABS})
+ SET(sbindir ${INSTALL_SBINDIRABS})
+ SET(scriptdir ${INSTALL_SCRIPTDIRABS})
+ SET(libexecdir ${INSTALL_SBINDIRABS})
+ SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS})
+ IF(INSTALL_SYSCONFDIR)
+ SET(sysconfdir ${INSTALL_SYSCONFDIR})
+ ELSEIF(DEFAULT_SYSCONFDIR)
+ SET(sysconfdir ${DEFAULT_SYSCONFDIR})
+ ELSE()
+ SET(sysconfdir "/etc")
+ ENDIF()
+ IF(INSTALL_SYSCONF2DIR)
+ SET(sysconf2dir ${INSTALL_SYSCONF2DIR})
+ ELSE()
+ SET(sysconf2dir "${sysconfdir}/mysql")
+ ENDIF()
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
+ INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
+ DESTINATION ${inst_location} COMPONENT SupportFiles)
+
+ IF(HAVE_SYSTEMD)
+ CONFIGURE_FILE(mariadb.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service @ONLY)
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ./mariadb.service mysql.service
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ./mariadb.service mysqld.service
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ INSTALL(FILES use_galera_new_cluster.conf
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql.service
+ ${CMAKE_CURRENT_BINARY_DIR}/mysqld.service
+ DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
+
+ # @ in directory name broken between CMake version 2.8.12.2 and 3.3
+ # http://public.kitware.com/Bug/view.php?id=14782
+ IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
+ CONFIGURE_FILE(mariadb@.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb@.service @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb@.service
+ DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
+ ENDIF()
+
+ IF(INSTALL_SYSTEMD_UNITDIR)
+ INSTALL(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql.service
+ ${CMAKE_CURRENT_BINARY_DIR}/mysqld.service
+ DESTINATION ${INSTALL_SYSTEMD_UNITDIR} COMPONENT Server)
+
+ # http://public.kitware.com/Bug/view.php?id=14782
+ IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
+ INSTALL(FILES use_galera_new_cluster.conf
+ DESTINATION
+ "${INSTALL_SYSTEMD_UNITDIR}/mariadb@bootstrap.service.d"
+ COMPONENT Server)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb@.service
+ DESTINATION ${INSTALL_SYSTEMD_UNITDIR} COMPONENT Server)
+ ENDIF()
+
+ ENDIF()
+ ENDIF()
+
+ # Allow installing sysusers and tmpusers without requiring SYSTEMD on the
+ # system. This is useful for distributions running other init systems to
+ # parse these files and create appropriate users & tmpfiles.
+ IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_SYSUSERS) AND INSTALL_SYSTEMD_SYSUSERSDIR)
+ CONFIGURE_FILE(sysusers.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
+ DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR}
+ RENAME mariadb.conf COMPONENT Server)
+ ENDIF()
+
+ IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_TMPUSERS) AND INSTALL_SYSTEMD_TMPFILESDIR)
+ get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
+ CONFIGURE_FILE(tmpfiles.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
+ DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR}
+ RENAME mariadb.conf COMPONENT Server)
+ ENDIF()
+
+ IF (INSTALL_SYSCONFDIR)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d
+ RENAME mysql COMPONENT SupportFiles)
+ IF(NOT HAVE_SYSTEMD)
+ INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
+ DESTINATION ${INSTALL_SYSCONFDIR}/init.d
+ RENAME mysql COMPONENT SupportFiles)
+ ENDIF()
+
+ INSTALL(FILES rpm/my.cnf DESTINATION ${INSTALL_SYSCONFDIR}
+ COMPONENT Common)
+
+ IF (INSTALL_SYSCONF2DIR)
+ INSTALL(FILES rpm/client.cnf DESTINATION ${INSTALL_SYSCONF2DIR}
+ COMPONENT SharedLibraries)
+ INSTALL(FILES rpm/mysql-clients.cnf DESTINATION ${INSTALL_SYSCONF2DIR}
+ COMPONENT Client)
+ INSTALL(FILES rpm/server.cnf DESTINATION ${INSTALL_SYSCONF2DIR}
+ COMPONENT IniFiles)
+ INSTALL(FILES rpm/enable_encryption.preset DESTINATION ${INSTALL_SYSCONF2DIR}
+ COMPONENT IniFiles)
+ ENDIF()
+
+ # This is for SuSE:
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
+ ${INSTALL_SYSCONFDIR}/init.d/mysql
+ ${INSTALL_SBINDIR}/rcmysql
+ WORKING_DIRECTORY \$ENV{DESTDIR}${prefix})"
+ COMPONENT SupportFiles)
+ ENDIF(INSTALL_SYSCONFDIR)
+ENDIF()
diff --git a/support-files/MacOSX/Description.plist.sh b/support-files/MacOSX/Description.plist.sh
new file mode 100644
index 00000000..9af3eddf
--- /dev/null
+++ b/support-files/MacOSX/Description.plist.sh
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (C) 2003 MySQL AB
+ Use is subject to license terms
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+-->
+<plist version="1.0">
+<dict>
+ <key>IFPkgDescriptionDeleteWarning</key>
+ <string></string>
+ <key>IFPkgDescriptionDescription</key>
+ <string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@ for Mac OS X</string>
+ <key>IFPkgDescriptionTitle</key>
+ <string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@ for Mac OS X</string>
+ <key>IFPkgDescriptionVersion</key>
+ <string>@VERSION@@MYSQL_SERVER_SUFFIX@</string>
+ </dict>
+</plist>
diff --git a/support-files/MacOSX/Info.plist.sh b/support-files/MacOSX/Info.plist.sh
new file mode 100644
index 00000000..c2033e42
--- /dev/null
+++ b/support-files/MacOSX/Info.plist.sh
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (C) 2003, 2008 MySQL AB
+ Use is subject to license terms
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+-->
+<plist version="1.0">
+<dict>
+ <key>CFBundleGetInfoString</key>
+ <string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.mysql.mysql</string>
+ <key>CFBundleName</key>
+ <string>MySQL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@MYSQL_NUMERIC_VERSION@</string>
+ <key>IFPkgFlagAllowBackRev</key>
+ <false/>
+ <key>IFPkgFlagAuthorizationAction</key>
+ <string>RootAuthorization</string>
+ <key>IFPkgFlagDefaultLocation</key>
+ <string>/usr/local</string>
+ <key>IFPkgFlagInstallFat</key>
+ <false/>
+ <key>IFPkgFlagIsRequired</key>
+ <false/>
+ <key>IFPkgFlagRelocatable</key>
+ <false/>
+ <key>IFPkgFlagRestartAction</key>
+ <string>NoRestart</string>
+ <key>IFPkgFlagRootVolumeOnly</key>
+ <true/>
+ <key>IFPkgFlagUpdateInstalledLanguages</key>
+ <false/>
+ <key>IFPkgFormatVersion</key>
+ <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/support-files/MacOSX/MySQLCOM b/support-files/MacOSX/MySQLCOM
new file mode 100755
index 00000000..ca5e444f
--- /dev/null
+++ b/support-files/MacOSX/MySQLCOM
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Copyright (C) 2003, 2004 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+#
+# /Library/StartupItems/MySQLCOM/MySQLCOM
+#
+# A script to automatically start up MySQL on system bootup
+# for Mac OS X. This is actually just a wrapper script around
+# the standard mysql.server init script, which is included in
+# the binary distribution.
+#
+# (c) 2003 MySQL AB
+# Written by Lenz Grimmer <lenz@mysql.com>
+#
+
+# Suppress the annoying "$1: unbound variable" error when no option
+# was given
+if [ -z $1 ] ; then
+ echo "Usage: $0 [start|stop|restart] "
+ exit 1
+fi
+
+# Source the common setup functions for startup scripts
+test -r /etc/rc.common || exit 1
+. /etc/rc.common
+
+# The path to the mysql.server init script. The official MySQL
+# Mac OS X packages are being installed into /usr/local/mysql.
+SCRIPT="/usr/local/mysql/support-files/mysql.server"
+
+StartService ()
+{
+ if [ "${MYSQLCOM:=-NO-}" = "-YES-" ] ; then
+ ConsoleMessage "Starting MySQL database server"
+ $SCRIPT start > /dev/null 2>&1
+ fi
+}
+
+StopService ()
+{
+ ConsoleMessage "Stopping MySQL database server"
+ $SCRIPT stop > /dev/null 2>&1
+}
+
+RestartService ()
+{
+ ConsoleMessage "Restarting MySQL database server"
+ $SCRIPT restart > /dev/null 2>&1
+}
+
+if test -x $SCRIPT ; then
+ RunService "$1"
+else
+ ConsoleMessage "Could not find MySQL startup script!"
+fi
diff --git a/support-files/MacOSX/ReadMe.txt b/support-files/MacOSX/ReadMe.txt
new file mode 100644
index 00000000..31fb0d97
--- /dev/null
+++ b/support-files/MacOSX/ReadMe.txt
@@ -0,0 +1,378 @@
+
+2.7. Installing MySQL on Mac OS X
+
+ MySQL for Mac OS X is available in a number of different forms:
+
+ * Native Package Installer format, which uses the native Mac OS
+ X installer to walk you through the installation of MySQL. For
+ more information, see Section 2.7.1, "Installing MySQL Using
+ the Installation Package." You can use the package installer
+ with Mac OS X 10.3 and later, and available for both PowerPC
+ and Intel architectures, and both 32-bit and 64-bit
+ architectures. There is no Universal Binary available using
+ the package installation method. The user you use to perform
+ the installation must have administrator privileges.
+
+ * Tar package format, which uses a file packaged using the Unix
+ tar and gzip commands. To use this method, you will need to
+ open a Terminal window. You do not need administrator
+ privileges using this method, as you can install the MySQL
+ server anywhere using this method. For more information on
+ using this method, you can use the generic instructions for
+ using a tarball, Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."You can use the package installer with
+ Mac OS X 10.3 and later, and available for both PowerPC and
+ Intel architectures, and both 32-bit and 64-bit architectures.
+ A Universal Binary, incorporating both Power PC and Intel
+ architectures and 32-bit and 64-bit binaries is available.
+ In addition to the core installation, the Package Installer
+ also includes Section 2.7.2, "Installing the MySQL Startup
+ Item" and Section 2.7.3, "Installing and Using the MySQL
+ Preference Pane," both of which simplify the management of
+ your installation.
+
+ * Mac OS X server includes a version of MySQL as standard. If
+ you want to use a more recent version than that supplied with
+ the Mac OS X server release, you can make use of the package
+ or tar formats. For more information on using the MySQL
+ bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
+ OS X Server."
+
+ For additional information on using MySQL on Mac OS X, see Section
+ 2.7.5, "MySQL Installation on Mac OS X Notes."
+
+2.7.1. Installing MySQL Using the Installation Package
+
+ You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
+ using a Mac OS X binary package in PKG format instead of the
+ binary tarball distribution. Please note that older versions of
+ Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
+ package.
+
+ The package is located inside a disk image (.dmg) file that you
+ first need to mount by double-clicking its icon in the Finder. It
+ should then mount the image and display its contents.
+
+Note
+
+ Before proceeding with the installation, be sure to shut down all
+ running MySQL server instances by either using the MySQL Manager
+ Application (on Mac OS X Server) or via mysqladmin shutdown on the
+ command line.
+
+ When installing from the package version, you should also install
+ the MySQL Preference Pane, which will allow you to control the
+ startup and execution of your MySQL server from System
+ Preferences. For more information, see Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+ When installing using the package installer, the files are
+ installed into a directory within /usr/local matching the name of
+ the installation version and platform. For example, the installer
+ file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
+ /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
+ of the directory is as shown in the following table:
+ Directory Contents of Directory
+ bin Client programs and the mariadbd server
+ data Log files, databases
+ docs Manual in Info format
+ include Include (header) files
+ lib Libraries
+ man Unix manual pages
+ mysql-test MySQL test suite
+ scripts Contains the mysql_install_db script
+ share/mysql Error message files
+ sql-bench Benchmarks
+ support-files Scripts and sample configuration files
+ /tmp/mysql.sock The location of the MySQL Unix socket
+
+ During the package installer process, a symbolic link from
+ /usr/local/mysql to the version/platform specific directory
+ created during installation will be created automatically.
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQL installer package. It will be named
+ according to the version of MySQL you have downloaded. For
+ example, if you have downloaded MySQL 5.1.39, double-click
+ mysql-5.1.39-osx10.5-x86.pkg.
+
+ 3. You will be presented with the openin installer dialog. Click
+ Continue to begihn installation.
+ MySQL Package Installer: Step 1
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. If you have downloaded the community version of MySQL, you
+ will be shown a copy of the relevant GNU General Public
+ License. Click Continue .
+
+ 6. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Package Installer: Step 4
+
+ 7. You will be asked to confirm the details of the installation,
+ including the space required for the installation. To change
+ the drive on which the startup item is installed you can click
+ either Go Back or Change Install Location.... To install the
+ startup item, click Install.
+
+ 8. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
+
+ Once you have completed the basic installation, you must complete
+ the post-installation steps as specified in Section 2.13,
+ "Post-Installation Setup and Testing."
+
+ For convenience, you may also want to install the Section 2.7.2,
+ "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+2.7.2. Installing the MySQL Startup Item
+
+ The MySQL Installation Package includes a startup item that can be
+ used to automatically startup and shutdown MySQL during boot.
+
+ To install the MySQL Startup Item:
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQLStartItem.pkg file to start the
+ installation process.
+
+ 3. You will be presented with the Install MySQL Startup Item
+ dialog.
+ MySQL Startup Item Installer: Step 1
+ Click Continue to continue the installation process.
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Startup Item Installer: Step 3
+
+ 6. You will be asked to confirm the details of the installation.
+ To change the drive on which the startup item is installed you
+ can click either Go Back or Change Install Location.... To
+ install the startup item, click Install.
+
+ 7. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
+ MySQL Startup Item Installer: Step 5
+
+ The Startup Item for MySQL is installed into
+ /Library/StartupItems/MySQLCOM. The Startup Item installation adds
+ a variable MYSQLCOM=-YES- to the system configuration file
+ /etc/hostconfig. If you want to disable the automatic startup of
+ MySQL, simply change this variable to MYSQLCOM=-NO-.
+
+ After the installation, you can start up MySQL by running the
+ following commands in a terminal window. You must have
+ administrator privileges to perform this task.
+
+ If you have installed the Startup Item, use this command to start
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
+
+ You may be prompted for your password to complete the startup.
+
+ If you have installed the Startup Item, use this command to stop
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
+
+ You may be prompted for your password to complete the shutdown.
+
+2.7.3. Installing and Using the MySQL Preference Pane
+
+ The MySQL Package installer disk image also includes a custom
+ MySQL Preference Pane that enables you to start, stop and control
+ automated startup during boot of your MySQL installation.
+
+ To install the MySQL Preference Pane:
+
+ 1. Download and open the MySQL package installer package, which
+ is provided on a disk image (.dmg). Double-click to open the
+ disk image, which includes the main MySQL installation
+ package, the MySQLStartupItem.pkg installation package, and
+ the MySQL.prefPane.
+
+ 2. Double click on MySQL.prefPane. The MySQL System Preferences
+ will open.
+
+ 3. If this is the first time you have installed the preference
+ pane, you will be asked to confirm installation and whether
+ you want to install the preference pane for all users, or only
+ the current user. To install the preference pane for all users
+ you will need administrator privileges. If necessary, you will
+ be prompted for the username and password for a user with
+ administrator privileges.
+
+ 4. If you already have the MySQL Preference Pane installed, you
+ will be asked to confirm whether you want to overwrite the
+ existing MySQL Preference Pane.
+
+Note
+
+ The MySQL Preference Pane only starts and stops MySQL installation
+ installed from the MySQL package installation that have been
+ installed in the default location.
+
+ Once the MySQL Preference Pane has been installed, you can control
+ your MySQL server instance using the preference pane. To use the
+ preference pane, open the System Preferences... from the Apple
+ menu. Select the MySQL preference pane by clicking on the MySQL
+ logo within the Other section of the preference panes list.
+ MySQL Preference Pane
+
+ The MySQL Preference Pane shows the current status of the MySQL
+ server, showing stopped (in red) if the server is not running and
+ running (in green) if the server has already been started. The
+ preference pane will also show the current setting for whether the
+ MySQL server has been set to start up automatically.
+
+ * To start MySQL using the preference pane:
+ Click Start MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to start
+ the MySQL server.
+
+ * To stop MySQL using the preference pane:
+ Click Stop MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to
+ shutdown the MySQL server.
+
+ * To automatically start the MySQL server when the system boots:
+ Check the checkbox next to Automatically Start MySQL Server on
+ Startup.
+
+ * To disable the automatic starting of the MySQL server when the
+ system boots:
+ Uncheck the checkbox next to Automatically Start MySQL Server
+ on Startup.
+
+ You can close the System Preferences... once you have completed
+ your settings.
+
+2.7.4. Using MySQL on Mac OS X Server
+
+ If you are running Mac OS X Server, a version of MySQL should
+ already be installed. The following table shows the versions of
+ MySQL that ship with Mac OS X Server versions.
+ Mac OS X Server Version MySQL Version
+ 10.2-10.2.2 3.23.51
+ 10.2.3-10.2.6 3.23.53
+ 10.3 4.0.14
+ 10.3.2 4.0.16
+ 10.4.0 4.1.10a
+ 10.5.0 5.0.45
+ 10.6.0 5.0.82
+
+ The installation layout of MySQL on Mac OS X Server is as shown in
+ the table below:
+ Directory Contents of Directory
+ /usr/bin Client programs
+ /var/mysql Log files, databases
+ /usr/libexec The mariadbd server
+ /usr/share/man Unix manual pages
+ /usr/share/mysql/mysql-test MySQL test suite
+ /usr/share/mysql Contains the mysql_install_db script
+ /var/mysql/mysql.sock The location of the MySQL Unix socket
+
+Note
+
+ The MySQL server bundled with Mac OS X Server does not include the
+ MySQL client libraries and header files required if you want to
+ access and use MySQL from a third-party driver, such as Perl DBI
+ or PHP. For more information on obtaining and installing MySQL
+ libraries, see Mac OS X Server version 10.5: MySQL libraries
+ available for download (http://support.apple.com/kb/TA25017).
+ Alternatively, you can ignore the bundled MySQL server and install
+ MySQL from the package or tarball installation.
+
+ For more information on managing the bundled MySQL instance in Mac
+ OS X Server 10.5, see Mac OS X Server: Web Technologies
+ Administration For Version 10.5 Leopard
+ (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
+ _v10.5.pdf). For more information on managing the bundled MySQL
+ instance in Mac OS X Server 10.6, see Mac OS X Server: Web
+ Technologies Administration Version 10.6 Snow Leopard
+ (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
+
+2.7.5. MySQL Installation on Mac OS X Notes
+
+ You should keep the following issues and notes in mind:
+
+ * The default location for the MySQL Unix socket is different on
+ Mac OS X and Mac OS X Server depending on the installation
+ type you chose. The default locations by installation are as
+ follows:
+
+ Package Installer from MySQL /tmp/mysql.sock
+ Tarball from MySQL /tmp/mysql.sock
+ MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
+ To prevent issues, you should either change the configuration
+ of the socket used within your application (for example,
+ changing php.ini), or you should configure the socket location
+ using a MySQL configuration file and the socket option. For
+ more information, see Section 5.1.2, "Server Command Options."
+
+ * You may need (or want) to create a specific mysql user to own
+ the MySQL directory and data. On Mac OS X 10.4 and lower you
+ can do this by using the Netinfo Manager application, located
+ within the Utilities folder within the Applications folder. On
+ Mac OS X 10.5 and later you can do this through the Directory
+ Utility. From Mac OS X 10.5 and later (including Mac OS X
+ Server 10.5) the mysql should already exist. For use in single
+ user mode, an entry for _mysql (note the underscore prefix)
+ should already exist within the system /etc/passwd file.
+
+ * Due to a bug in the Mac OS X package installer, you may see
+ this error message in the destination disk selection dialog:
+You cannot install this software on this disk. (null)
+ If this error occurs, simply click the Go Back button once to
+ return to the previous screen. Then click Continue to advance
+ to the destination disk selection again, and you should be
+ able to choose the destination disk correctly. We have
+ reported this bug to Apple and it is investigating this
+ problem.
+
+ * Because the MySQL package installer installs the MySQL
+ contents into a version and platform specific directory, you
+ can use this to upgrade and migrate your database between
+ versions. You will need to either copy the data directory from
+ the old version to the new version, or alternatively specify
+ an alternative datadir value to set location of the data
+ directory.
+
+ * You might want to add aliases to your shell's resource file to
+ make it easier to access commonly used programs such as mysql
+ and mysqladmin from the command line. The syntax for bash is:
+alias mysql=/usr/local/mysql/bin/mysql
+alias mysqladmin=/usr/local/mysql/bin/mysqladmin
+ For tcsh, use:
+alias mysql /usr/local/mysql/bin/mysql
+alias mysqladmin /usr/local/mysql/bin/mysqladmin
+ Even better, add /usr/local/mysql/bin to your PATH environment
+ variable. You can do this by modifying the appropriate startup
+ file for your shell. For more information, see Section 4.2.1,
+ "Invoking MySQL Programs."
+
+ * After you have copied over the MySQL database files from the
+ previous installation and have successfully started the new
+ server, you should consider removing the old installation
+ files to save disk space. Additionally, you should also remove
+ older versions of the Package Receipt directories located in
+ /Library/Receipts/mysql-VERSION.pkg.
diff --git a/support-files/MacOSX/StartupItem.Description.plist b/support-files/MacOSX/StartupItem.Description.plist
new file mode 100644
index 00000000..1374ca94
--- /dev/null
+++ b/support-files/MacOSX/StartupItem.Description.plist
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (C) 2003, 2004 MySQL AB
+ Use is subject to license terms
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+-->
+<plist version="1.0">
+<dict>
+ <key>IFPkgDescriptionDeleteWarning</key>
+ <string></string>
+ <key>IFPkgDescriptionDescription</key>
+ <string>This package enables MySQL to be started up automatically
+ on system bootup.</string>
+ <key>IFPkgDescriptionTitle</key>
+ <string>MySQL Startup Item</string>
+ <key>IFPkgDescriptionVersion</key>
+ <string>1.1</string>
+</dict>
+</plist>
diff --git a/support-files/MacOSX/StartupItem.Info.plist b/support-files/MacOSX/StartupItem.Info.plist
new file mode 100644
index 00000000..947c81c7
--- /dev/null
+++ b/support-files/MacOSX/StartupItem.Info.plist
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (C) 2003 MySQL AB
+ Use is subject to license terms
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+-->
+<plist version="1.0">
+<dict>
+ <key>CFBundleGetInfoString</key>
+ <string>MySQL Startup Item</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.mysql.mysqlstartup</string>
+ <key>CFBundleName</key>
+ <string>MySQL Startup Item</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>IFMajorVersion</key>
+ <integer>1</integer>
+ <key>IFMinorVersion</key>
+ <integer>0</integer>
+ <key>IFPkgFlagAllowBackRev</key>
+ <false/>
+ <key>IFPkgFlagAuthorizationAction</key>
+ <string>RootAuthorization</string>
+ <key>IFPkgFlagDefaultLocation</key>
+ <string>/Library/StartupItems</string>
+ <key>IFPkgFlagInstallFat</key>
+ <false/>
+ <key>IFPkgFlagIsRequired</key>
+ <false/>
+ <key>IFPkgFlagRelocatable</key>
+ <false/>
+ <key>IFPkgFlagRestartAction</key>
+ <string>NoRestart</string>
+ <key>IFPkgFlagRootVolumeOnly</key>
+ <true/>
+ <key>IFPkgFlagUpdateInstalledLanguages</key>
+ <false/>
+ <key>IFPkgFormatVersion</key>
+ <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/support-files/MacOSX/StartupItem.postinstall b/support-files/MacOSX/StartupItem.postinstall
new file mode 100755
index 00000000..d67abc9d
--- /dev/null
+++ b/support-files/MacOSX/StartupItem.postinstall
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# Copyright (C) 2003 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+#
+# postinstall script for the MySQL Startup Item Installation package
+#
+# This script modifies /etc/hostconfig in the following ways:
+#
+# - On Mac OS X Server, it disables the startup of the default MySQL
+# installation by changing the "MYSQL" start variable to "-NO-".
+# - If not existent already, it adds a "MYSQLCOM" start variable, which
+# defaults to "-YES-". An already existing MYSQLCOM variable will remain
+# untouched.
+#
+# (c) 2003 MySQL AB
+# Author: Lenz Grimmer <lenz@mysql.com>
+#
+
+CONFFILE="/etc/hostconfig"
+TMPFILE=`basename $CONFFILE` || exit 1
+TMPFILE=`mktemp -t $TMPFILE.tmp` || exit 1
+
+test -e $CONFFILE || exit 1
+
+# Disable the startup of the default MySQL installation that ships with
+# Mac OS X Server to avoid conflicts with our installation on bootup
+sed -e s/^MYSQL=-YES-/MYSQL=-NO-/g < $CONFFILE > $TMPFILE
+
+# Add our MYSQLCOM startup variable (enabled by default)
+grep -q "^MYSQLCOM" $CONFFILE > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+ echo "MYSQLCOM=-YES-" >> $TMPFILE
+fi
+
+# Install the modified file into the default location
+cp -f $CONFFILE $CONFFILE~ || exit 1
+mv -f $TMPFILE $CONFFILE || echo "Error while installing new $CONFFILE!"
+chmod 644 $CONFFILE
diff --git a/support-files/MacOSX/StartupParameters.plist.sh b/support-files/MacOSX/StartupParameters.plist.sh
new file mode 100644
index 00000000..f92385a8
--- /dev/null
+++ b/support-files/MacOSX/StartupParameters.plist.sh
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (C) 2003 MySQL AB
+ Use is subject to license terms
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+-->
+<plist version="1.0">
+<dict>
+ <key>Description</key>
+ <string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@</string>
+ <key>OrderPreference</key>
+ <string>None</string>
+ <key>Provides</key>
+ <array>
+ <string>MySQL</string>
+ </array>
+ <key>Uses</key>
+ <array>
+ <string>Network</string>
+ <string>Resolver</string>
+ </array>
+ </dict>
+</plist>
diff --git a/support-files/MacOSX/mwar-wrapper b/support-files/MacOSX/mwar-wrapper
new file mode 100755
index 00000000..79ec570b
--- /dev/null
+++ b/support-files/MacOSX/mwar-wrapper
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Copyright (C) 2005 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+# This script can only create a library, not take it apart
+# again to AR files
+
+case $1 in
+ -d*|-m*|-t*|-p*|-r*|-x*|x)
+ echo "$0: can't handle arguments $*"
+ exit 1;
+ ;;
+ -c|c|cr|cru|cu)
+ shift;
+ ;;
+esac
+
+exec mwld -lib -o $*
diff --git a/support-files/MacOSX/mwcc-wrapper b/support-files/MacOSX/mwcc-wrapper
new file mode 100755
index 00000000..6a3e5394
--- /dev/null
+++ b/support-files/MacOSX/mwcc-wrapper
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+# Copyright (C) 2005 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+if [ -z "$CWINSTALL" ] ; then
+ echo "ERROR: You need to source 'mwvars' to set CWINSTALL and other variables"
+ exit 1
+fi
+
+if [ `expr "$MWMacOSXPPCLibraryFiles" : ".*BSD.*"` = 0 ] ; then
+ echo "ERROR: You need to source 'mwvars' with the 'bsd' argument"
+ exit 1
+fi
+
+# ==============================================================================
+
+# Extra options that don't change
+
+PREOPTS="-D__SCHAR_MAX__=127 -D__CHAR_BIT__=8 -ext o -gccinc"
+PREOPTS="$PREOPTS -wchar_t on -bool on -relax_pointers -align power_gcc"
+PREOPTS="$PREOPTS -stabs all -fno-handle-exceptions -Cpp_exceptions off"
+
+# ==============================================================================
+
+# We want the "PPC Specific" directory to be last, before the source
+# file. It is to work around a CodeWarrior/Apple bug, that we need a
+# Metrowersk header even though we have configured CodeWarrior to use
+# the BSD headers. But not to conflict, the directory has to be last.
+
+# FIXME this will probably break if one path contains space characters
+
+PREARGS=""
+for i in $* ; do
+ case "$i" in
+ -bind_at_load)
+ # This is a flag some version of libtool adds, when the host
+ # is "*darwin*". It doesn't check that it is gcc.
+ # FIXME add some flag?!
+ ;;
+ *.c|*.cc|*.cpp)
+ break
+ ;;
+ *)
+ PREARGS="$PREARGS $1"
+ ;;
+ esac
+ shift
+done
+#echo "mwcc $PREOPTS $PREARGS -I\"$CWINSTALL/MacOS X Support/Headers/PPC Specific\" $*"
+exec mwcc $PREOPTS $PREARGS -I"$CWINSTALL/MacOS X Support/Headers/PPC Specific" $*
diff --git a/support-files/MacOSX/postflight.sh b/support-files/MacOSX/postflight.sh
new file mode 100644
index 00000000..752eddc4
--- /dev/null
+++ b/support-files/MacOSX/postflight.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# Copyright (C) 2003, 2005 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335 USA
+
+#
+# postflight - this script will be executed after the MySQL PKG
+# installation has been performed.
+#
+# This script will install the MySQL privilege tables using the
+# "mysql_install_db" script and will correct the ownerships of these files
+# afterwards.
+#
+
+if cd @prefix@ ; then
+ if [ ! -f data/mysql/db.frm ] ; then
+ ./scripts/mysql_install_db --rpm
+ fi
+
+ if [ -d data ] ; then
+ chown -R @MYSQLD_USER@ data
+ fi
+else
+ exit $?
+fi
diff --git a/support-files/MacOSX/preflight.sh b/support-files/MacOSX/preflight.sh
new file mode 100644
index 00000000..ce466d5b
--- /dev/null
+++ b/support-files/MacOSX/preflight.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Copyright (C) 2003, 2005 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335 USA
+
+#
+# preflight - this script will be executed before the MySQL PKG
+# installation will be performed.
+#
+# If this package has been compiled with a prefix ending with "mysql" (e.g.
+# /usr/local/mysql or /opt/mysql), it will rename any previously existing
+# directory with this name before installing the new package (which includes
+# a symlink named "mysql", pointing to the newly installed directory, which
+# is named mysql-<version>)
+#
+
+PREFIX="@prefix@"
+BASENAME=`basename $PREFIX`
+
+if [ -d $PREFIX -a ! -L $PREFIX -a $BASENAME = "mysql" ] ; then
+ mv $PREFIX $PREFIX.bak
+fi
diff --git a/support-files/binary-configure.sh b/support-files/binary-configure.sh
new file mode 100644
index 00000000..47123668
--- /dev/null
+++ b/support-files/binary-configure.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+SCRIPT_NAME="`basename $0`"
+
+usage()
+{
+ echo "Usage: ${SCRIPT_NAME} [--help|-h]"
+ echo ""
+ echo "This script creates the MySQL system tables and starts the server."
+}
+
+for arg do
+ case "$arg" in
+ --help|-h)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "${SCRIPT_NAME}: unknown option $arg"
+ usage
+ exit 2
+ ;;
+ esac
+done
+
+if test ! -x ./scripts/mysql_install_db
+then
+ echo "I didn't find the script './scripts/mysql_install_db'."
+ echo "Please execute this script in the mysql distribution directory!"
+ exit 1;
+fi
+
+echo "NOTE: This is a MySQL binary distribution. It's ready to run, you don't"
+echo "need to configure it!"
+echo ""
+echo "To help you a bit, I am now going to create the needed MySQL databases"
+echo "and start the MySQL server for you. If you run into any trouble, please"
+echo "consult the MySQL manual, that you can find in the Docs directory."
+echo ""
+
+./scripts/mysql_install_db --no-defaults
+if [ $? = 0 ]
+then
+ echo "Starting the mariadbd server. You can test that it is up and running"
+ echo "with the command:"
+ echo "./bin/mysqladmin version"
+ ./bin/mysqld_safe --no-defaults &
+fi
diff --git a/support-files/build-tags b/support-files/build-tags
new file mode 100755
index 00000000..660a7d7f
--- /dev/null
+++ b/support-files/build-tags
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+rm -f TAGS
+
+if git rev-parse HEAD >/dev/null 2>&1
+then
+ cd `git rev-parse --show-toplevel`
+ echo sql mysys strings client storage dbug libmysql sql-common \
+ extra mysys_ssl strings regex pcre vio include \
+ tools unittest plugin libmysqld | \
+ xargs -n1 git ls-files | grep -v '\.jar$' | grep -v '\.xz$' | \
+ xargs etags -o TAGS --append
+else
+ find . -type f ! -name "*.jar" |
+ xargs etags -o TAGS --append
+fi
diff --git a/support-files/ccfilter b/support-files/ccfilter
new file mode 100644
index 00000000..4e2c6f57
--- /dev/null
+++ b/support-files/ccfilter
@@ -0,0 +1,119 @@
+#! /usr/bin/perl
+
+# Post-processor for compiler output to filter out warnings matched in
+# support-files/compiler_warnings.supp. This makes it easier to check
+# that no new warnings are introduced without needing to submit a build
+# for Buildbot.
+#
+# Use by setting CC="ccfilter gcc" CXX="ccfilter gcc" before ./configure.
+#
+# When testing from command line, you can run it as
+# perl ccfilter cat logfile > /dev/null
+# to see the errors that are not filtered
+#
+# By default, just filters the output for suppressed warnings. If the
+# FAILONWARNING environment variable is set, then instead will fail the
+# compile on encountering a non-suppressed warnings.
+
+
+use strict;
+use warnings;
+
+my $suppressions;
+my $filter_stderr= $ARGV[0] ne "cat";
+
+open STDOUT_COPY, ">&STDOUT"
+ or die "Failed to dup stdout: $!]n";
+
+my $pid= open(PIPE, '-|');
+
+if (!defined($pid)) {
+ die "Error: Cannot fork(): $!\n";
+} elsif (!$pid) {
+ # Child.
+ # actually want to send the STDERR to the parent, not the STDOUT.
+ # So shuffle things around a bit.
+ if ($filter_stderr)
+ {
+ open STDERR, ">&STDOUT"
+ or die "Child: Failed to dup pipe to parent: $!\n";
+ open STDOUT, ">&STDOUT_COPY"
+ or die "Child: Failed to dup parent stdout: $!\n";
+ close STDOUT_COPY;
+ }
+ exec { $ARGV[0] } @ARGV;
+ die "Child: exec() failed: $!\n";
+} else {
+ # Parent.
+ close STDOUT_COPY;
+ my $cwd= qx(pwd);
+ chomp($cwd);
+ while (<PIPE>) {
+ my $line= $_;
+ if (/^(.*?):([0-9]+):(?:[0-9]+:)? [Ww]arning: (.*)$/) {
+ my ($file, $lineno, $msg)= ($1, $2, $3);
+ $file= "$cwd/$file" if (length($file) > 0 && substr($file,0,1) ne "/");
+
+ next
+ if check_if_suppressed($file, $lineno, $msg);
+ die "$line\nGot warning, terminating.\n"
+ if $ENV{FAILONWARNING};
+ print STDERR $line;
+ next;
+ }
+ if ($filter_stderr)
+ {
+ print STDERR $line;
+ }
+ else
+ {
+ print STDOUT $line;
+ }
+ }
+ close(PIPE);
+}
+
+exit 0;
+
+sub check_if_suppressed {
+ my ($file, $lineno, $msg)= @_;
+ load_suppressions() unless defined($suppressions);
+ for my $s (@$suppressions) {
+ my ($file_re, $msg_re, $start, $end)= @$s;
+ if ($file =~ /$file_re/ &&
+ $msg =~ /$msg_re/ &&
+ (!defined($start) || $start <= $lineno) &&
+ (!defined($end) || $end >= $lineno)) {
+ return 1;
+ }
+ }
+ return undef;
+}
+
+sub load_suppressions {
+ # First find the suppressions file, might be we need to move up to
+ # the base directory.
+ my $path = "support-files/compiler_warnings.supp";
+ my $exists;
+ for (1..10) {
+ $exists= -f $path;
+ last if $exists;
+ $path= '../'. $path;
+ }
+ die "Error: Could not find suppression file (out of source dir?).\n"
+ unless $exists;
+
+ $suppressions= [];
+ open "F", "<", $path
+ or die "Error: Could not read suppression file '$path': $!\n";
+ while (<F>) {
+ # Skip comment and empty lines.
+ next if /^\s*(\#.*)?$/;
+ die "Invalid syntax in suppression file '$path', line $.:\n$_"
+ unless /^\s*(.+?)\s*:\s*(.+?)\s*(?:[:]\s*([0-9]+)(?:-([0-9]+))?\s*)?$/;
+ my ($file_re, $line_re, $start, $end)= ($1, $2, $3, $4);
+ $end = $start
+ if defined($start) && !defined($end);
+ push @$suppressions, [$file_re, $line_re, $start, $end];
+ }
+}
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
new file mode 100644
index 00000000..92f856f7
--- /dev/null
+++ b/support-files/compiler_warnings.supp
@@ -0,0 +1,225 @@
+#
+# This file contains compiler warnings that can
+# be ignored for various reasons.
+#
+
+.*/integer.cpp: .*control reaches end of non-void function.*: 1288-1427
+.*/integer.cpp: .*no return statement in function returning non-void.*: 1288-1427
+.*/DictTabInfo.cpp : .*invalid access to non-static.*
+.*/DictTabInfo.cpp : .*macro was used incorrectly.*
+.*/DbdihMain.cpp : .*unused variable.* : 6666-7013
+.*/DbtupExecQuery.cpp : .*unused variable.* : 1823
+.*/kernel_types.h : .*only defines private constructors and has no friends.* : 51
+.*/Dbtup.hpp: .*only defines private constructors and has no friends.*
+.*/diskpage.hpp: .*only defines private constructors and has no friends.*
+.*/tuppage.hpp: .*only defines private constructors and has no friends.*
+.*/sql_yacc.cc : .*label 'yyerrlab1' defined but not used.*
+.*/kernel_types.h : .*'struct Local_key' only defines private constructors and has no friends.*
+.*/lgman.hpp : .*'struct Lgman::Buffer_idx' only defines private constructors and has no friends.*
+.*/SchemaFile.hpp : .*'struct SchemaFile::TableEntry' only defines private constructors and has no friends.*
+.*/sql_yacc.cc : .*switch statement contains 'default' but no 'case' labels.*
+
+#
+# bdb is not critical to keep up to date
+#
+.*/bdb/.* : .*discards qualifiers from pointer target type.*
+.*/bdb/.* : .*unused parameter.*
+.*/bdb/.* : .*may be used uninitialized.*
+.*/bdb/.* : .*empty body in an if-statement.*
+.*/db_vrfy.c : .*comparison is always false due to limited range of data type.*
+
+#
+# readline is not maintained by us
+#
+.*/cmd-line-utils/readline/.* : .*
+.*/readline\.c : unused parameter
+.*/term\.c : unused parameter
+.*/vi\.c : unused parameter
+.*/common\.c : unused parameter
+.*/term\.c : .*
+
+#
+# Ignore some warnings in libevent, which is not maintained by us.
+#
+.*/extra/libevent/.* : .*unused parameter.*
+.*/extra/libevent/select\.c : .*comparison between signed and unsigned.* : 270-280
+.*/signal\.c : .*unused parameter.*
+
+#
+# Ignore warnings from system libraries
+#
+.*/aclocal/audiofile.m4 : .*
+
+#
+# Ignore strict-aliasing warnings (for now)
+#
+.*: break strict-aliasing rules
+
+#
+# Ignore not important declaration warnings
+#
+.*: only defines private constructors and has no friends
+
+#
+# Ignore all conversion warnings on windows 64
+# (Is safe as we are not yet supporting strings >= 2G)
+#
+.* : conversion from '__int64' to .*int'.*
+.* : conversion from '__int64' to 'uint8'.*
+.* : conversion from '__int64' to 'uint32'.*
+.* : conversion from '__int64' to 'u.*long'.*
+.* : conversion from '__int64' to 'long'.*
+.* : conversion from '__int64' to 'off_t'.*
+.* : conversion from '.*size_t' to .*int'.*
+.* : conversion from '.*size_t' to 'TaoCrypt::word32'.*
+.* : conversion from '.*size_t' to 'u.*long'.*
+.* : conversion from '.*size_t' to 'uint32'.*
+.* : conversion from '.*size_t' to 'off_t'.*
+.* : conversion from '.*size_t' to 'size_s'.*
+.* : conversion from '.*size_t' to 'DWORD'.*
+.* : conversion from '.*size_t' to 'uLongf'.*
+.* : conversion from '.*size_t' to 'UINT'.*
+.* : conversion from '.*size_t' to 'uInt'.*
+.* : conversion from '.*size_t' to 'uint16'.*
+.* : The following environment variables were not found.*
+.* : no public symbols found; archive member will be inaccessible
+.* : DESCRIPTION statement not supported
+
+# Ignore uninitialized local variables on windows
+.* : uninitialized local variable .* used
+
+#
+# Aria warning that is ok in debug builds
+#
+.*/storage/maria/ma_pagecache.c: .*'info_check_pin' defined but not used
+
+#
+# oqgraph errors that are hard to fix
+#
+.*/oqgraph/graphcore\.cc : may be used uninitialized in this function
+
+#
+# OpenSSL
+#
+# The following comes because of different prototype between yassl and openssl.
+# Save as the argument is a function within the library.
+.*/vio/viosslfactories\.c: discards ~const~ qualifier from pointer target type
+
+#
+# Groff warnings on OpenSUSE.
+#
+.*/dbug/.*(groff|<standard input>) : .*
+.*groff.* : vertical spacing must be greater than
+
+#
+# Warnings on OpenSolaris
+#
+.*/my_config\.h : _FILE_OFFSET_BITS
+.*/include/sys/feature_tests.h : this is the location of the previous definition
+.*/auth_pam\.c : initialization from incompatible pointer type : 100-200
+.*/mysys/my_lock\.c : incompatible pointer
+
+#
+# jemalloc
+#
+.*/jemalloc/src/jemalloc\.c: always_inline function might not be inlinable
+.*/jemalloc/src/jemalloc\.c: set but not used
+
+#
+# Connect engine
+#
+.*/storage/connect/ha_connect\.cc: might be clobbered by.*longjmp
+.*/storage/connect/connect\.cc: might be clobbered by.*longjmp
+.*/storage/connect/filamvct\.cpp: ignoring return value of
+.*/storage/connect/filamvct\.cpp: might be clobbered by
+.*/storage/connect/xindex\.cpp: ignoring return value of
+.*/storage/connect/value\.cpp: always false : 1000-1020
+.*/storage/connect/json\.cpp: might be clobbered by
+.*/storage/connect/filemdbf\.cpp: ignoring return value.*fwrite
+.*/storage/connect/value\.cpp: .*comparison is always false due to limited range
+
+#
+# mroonga
+#
+.*/groonga/lib/expr\.c : GCSE disabled
+.*/groonga/lib/expr\.c : NULL pointer checks disabled
+.*/groonga/lib/expr\.c : PRE disabled
+.*/groonga/lib/expr\.c : always false
+.*/groonga/lib/expr\.c : jump bypassing disabled
+.*/groonga/lib/expr\.c : propagation disabled
+.*/groonga/lib/nfkc\.c : GCSE disabled
+.*/groonga/lib/nfkc\.c : NULL pointer checks disabled
+.*/groonga/lib/nfkc\.c : jump bypassing disabled
+.*/groonga/lib/str\.c : comparing floating point
+.*/groonga/lib/db\.c : missing initializer
+.*/groonga/lib/ii\.c : missing initializer
+.*/groonga/lib/normalizer\.c : missing initializer
+.*/groonga/lib/proc\.c : missing initializer
+.*/groonga/lib/tokenizer\.c : missing initializer
+
+#
+# TokuDB
+#
+
+# This one is marked with __attribute__, but we still get a (wrong) warning
+.*/liblzma/lz/lz_encoder\.c : variable.*in_used.*set but not used
+
+#
+# pcre
+#
+.*/pcre/pcre_exec\.c: noclone.*attribute directive ignored
+
+#
+# Unexplanable (?) stuff
+#
+.*/listener\.cc : .*conversion from 'SOCKET' to 'int'.*
+.*/net_serv\.cc : .*conversion from 'SOCKET' to 'int'.*
+
+#
+# Ignorable warnings from header files
+#
+.*/backward_warning\.h : This file includes at least one
+/usr/include/i386-linux-gnu/bits/string3\.h: memset used with constant zero length parameter
+.*/bits/string3.h : might overflow destination buffer
+
+# allow a little moving space for the warning below
+.*/mi_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600
+.*/ma_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 550-650
+
+#
+# Wrong compiler warnings
+#
+.* : .*no matching operator delete found; memory will not be freed if initialization throws an exception.*
+.*/ctype-simple\.c : .*unary minus operator applied to unsigned type, result still unsigned.*
+.*/sql/sys_vars\.cc : invalid access to non-static data member
+.*/string3\.h : memset used with constant zero length parameter
+.* : missing-declarations.*is valid
+
+#
+# Ignorable errors on mac
+#
+.*/my_aes\.c: deprecated
+.*/my_sha1\.cc: deprecated
+.*/my_md5\.cc: deprecated
+.*/my_rnd\.cc: deprecated
+.*/mdl\.cc: invalid access
+.*/mdl\.cc: offsetoff
+
+# Wrong warning due to GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
+.*/regexec\.c : passing argument 3 of.*matcher.* discards qualifiers from pointer target type
+.*/libmysql\.c: passing argument 2 of .*memcpy.* discards qualifiers from pointer target type : 3000-4000
+.*/storage/.*/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500
+.*/storage/.*/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300
+.*/storage/.*/btr/btr0sea\.c : passing argument 2 of .*btr_cur_position.* discards qualifiers from pointer
+
+# Fixed wrong warning in GCC due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61520
+.*/strings/decimal\.c : array subscript is .* array bounds
+
+#
+# Strange things from autoconf that is probably safe to ignore
+#
+
+.*configure.in : warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
+.*configure.in : config/ac-macros/character_sets.m4.*prefer named diversions warning: File listed twice
+.*/include/mysql/client_plugin\.h : _mysql_client_plugin_declaration_
+.*/plugin/auth_gssapi/client_plugin\.cc: _mysql_client_plugin_declaration_
diff --git a/support-files/db.opt b/support-files/db.opt
new file mode 100644
index 00000000..d8429c4e
--- /dev/null
+++ b/support-files/db.opt
@@ -0,0 +1,2 @@
+default-character-set=latin1
+default-collation=latin1_swedish_ci
diff --git a/support-files/dtrace/locktime.d b/support-files/dtrace/locktime.d
new file mode 100644
index 00000000..398a7262
--- /dev/null
+++ b/support-files/dtrace/locktime.d
@@ -0,0 +1,65 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Shows the time that an individual lock is applied to a database and table
+# Shows the time to achieve the lock, and the time the table was locked
+
+o#pragma D option quiet
+
+mysql*:::handler-rdlock-start
+{
+ self->rdlockstart = timestamp;
+ this->lockref = strjoin(copyinstr(arg0),strjoin("@",copyinstr(arg1)));
+ self->lockmap[this->lockref] = self->rdlockstart;
+ printf("Start: Lock->Read %s.%s\n",copyinstr(arg0),copyinstr(arg1));
+}
+
+mysql*:::handler-wrlock-start
+{
+ self->wrlockstart = timestamp;
+ this->lockref = strjoin(copyinstr(arg0),strjoin("@",copyinstr(arg1)));
+ self->lockmap[this->lockref] = self->rdlockstart;
+ printf("Start: Lock->Write %s.%s\n",copyinstr(arg0),copyinstr(arg1));
+}
+
+mysql*:::handler-unlock-start
+{
+ self->unlockstart = timestamp;
+ this->lockref = strjoin(copyinstr(arg0),strjoin("@",copyinstr(arg1)));
+ printf("Start: Lock->Unlock %s.%s (%d ms lock duration)\n",
+ copyinstr(arg0),copyinstr(arg1),
+ (timestamp - self->lockmap[this->lockref])/1000000);
+}
+
+mysql*:::handler-rdlock-done
+{
+ printf("End: Lock->Read %d ms\n",
+ (timestamp - self->rdlockstart)/1000000);
+}
+
+mysql*:::handler-wrlock-done
+{
+ printf("End: Lock->Write %d ms\n",
+ (timestamp - self->wrlockstart)/1000000);
+}
+
+mysql*:::handler-unlock-done
+{
+ printf("End: Lock->Unlock %d ms\n",
+ (timestamp - self->unlockstart)/1000000);
+}
diff --git a/support-files/dtrace/query-execandqc.d b/support-files/dtrace/query-execandqc.d
new file mode 100644
index 00000000..feb93785
--- /dev/null
+++ b/support-files/dtrace/query-execandqc.d
@@ -0,0 +1,52 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Show query execution times, indicating whether the query-cache was used
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-20s %-20s %-40s %2s %-9s\n", "Who", "Database", "Query", "QC", "Time(ms)");
+}
+
+mysql*:::query-start
+{
+ self->query = copyinstr(arg0);
+ self->connid = arg1;
+ self->db = copyinstr(arg2);
+ self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4)));
+ self->querystart = timestamp;
+ self->qc = 0;
+}
+
+mysql*:::query-cache-hit
+{
+ self->qc = 1;
+}
+
+mysql*:::query-cache-miss
+{
+ self->qc = 0;
+}
+
+mysql*:::query-done
+{
+ printf("%-20s %-20s %-40s %-2s %-9d\n",self->who,self->db,self->query,(self->qc ? "Y" : "N"),
+ (timestamp - self->querystart) / 1000000);
+}
diff --git a/support-files/dtrace/query-filesort-time.d b/support-files/dtrace/query-filesort-time.d
new file mode 100644
index 00000000..3bffd078
--- /dev/null
+++ b/support-files/dtrace/query-filesort-time.d
@@ -0,0 +1,63 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Show the time taken for a query, including the time taken to
+# sort the results using filesort
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-2s %-10s %-10s %9s %18s %-s \n",
+ "St", "Who", "DB", "ConnID", "Dur microsec", "Query");
+}
+
+mysql*:::query-start
+{
+ self->query = copyinstr(arg0);
+ self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4)));
+ self->db = copyinstr(arg2);
+ self->connid = arg1;
+ self->querystart = timestamp;
+ self->filesort = 0;
+ self->fsdb = "";
+ self->fstable = "";
+}
+
+mysql*:::filesort-start
+{
+ self->filesort = timestamp;
+ self->fsdb = copyinstr(arg0);
+ self->fstable = copyinstr(arg1);
+}
+
+mysql*:::filesort-done
+{
+ this->elapsed = (timestamp - self->filesort) /1000;
+ printf("%2d %-10s %-10s %9d %18d Filesort on %s\n",
+ arg0, self->who, self->fsdb,
+ self->connid, this->elapsed, self->fstable);
+}
+
+mysql*:::query-done
+{
+ this->elapsed = (timestamp - self->querystart) /1000;
+ printf("%2d %-10s %-10s %9d %18d %s\n",
+ arg0, self->who, self->db,
+ self->connid, this->elapsed, self->query);
+}
diff --git a/support-files/dtrace/query-network-time.d b/support-files/dtrace/query-network-time.d
new file mode 100644
index 00000000..bf3c05e5
--- /dev/null
+++ b/support-files/dtrace/query-network-time.d
@@ -0,0 +1,79 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Show the time taken to execute a query, include the bytes and time taken
+# to transfer the information over the network to/from the client
+
+#pragma D option quiet
+#pragma D option dynvarsize=4m
+
+dtrace:::BEGIN
+{
+ printf("%-2s %-30s %-10s %9s %18s %-s \n",
+ "St", "Who", "DB", "ConnID", "Dur microsec", "Query");
+}
+
+mysql*:::query-start
+{
+ self->query = copyinstr(arg0);
+ self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4)));
+ self->db = copyinstr(arg2);
+ self->connid = arg1;
+ self->querystart = timestamp;
+ self->netwrite = 0;
+ self->netwritecum = 0;
+ self->netwritebase = 0;
+ self->netread = 0;
+ self->netreadcum = 0;
+ self->netreadbase = 0;
+}
+
+mysql*:::net-write-start
+{
+ self->netwrite += arg0;
+ self->netwritebase = timestamp;
+}
+
+mysql*:::net-write-done
+{
+ self->netwritecum += (timestamp - self->netwritebase);
+ self->netwritebase = 0;
+}
+
+mysql*:::net-read-start
+{
+ self->netreadbase = timestamp;
+}
+
+mysql*:::net-read-done
+{
+ self->netread += arg1;
+ self->netreadcum += (timestamp - self->netreadbase);
+ self->netreadbase = 0;
+}
+
+mysql*:::query-done
+{
+ this->elapsed = (timestamp - self->querystart) /1000000;
+ printf("%2d %-30s %-10s %9d %18d %s\n",
+ arg0, self->who, self->db,
+ self->connid, this->elapsed, self->query);
+ printf("Net read: %d bytes (%d ms) write: %d bytes (%d ms)\n",
+ self->netread, (self->netreadcum/1000000),
+ self->netwrite, (self->netwritecum/1000000));
+}
diff --git a/support-files/dtrace/query-parse-time.d b/support-files/dtrace/query-parse-time.d
new file mode 100644
index 00000000..7564068a
--- /dev/null
+++ b/support-files/dtrace/query-parse-time.d
@@ -0,0 +1,39 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Shows time take to actually parse the query statement
+
+#pragma D option quiet
+
+mysql*:::query-parse-start
+{
+ self->parsestart = timestamp;
+ self->parsequery = copyinstr(arg0);
+}
+
+mysql*:::query-parse-done
+/arg0 == 0/
+{
+ printf("Parsing %s: %d microseconds\n", self->parsequery,((timestamp - self->parsestart)/1000));
+}
+
+mysql*:::query-parse-done
+/arg0 != 0/
+{
+ printf("Error parsing %s: %d microseconds\n", self->parsequery,((timestamp - self->parsestart)/1000));
+}
diff --git a/support-files/dtrace/query-rowops.d b/support-files/dtrace/query-rowops.d
new file mode 100644
index 00000000..2c93f21b
--- /dev/null
+++ b/support-files/dtrace/query-rowops.d
@@ -0,0 +1,82 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Calculates the time (and operations) for accessing data from individual
+# rows for each query
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-2s %-10s %-10s %9s %9s %-s \n",
+ "St", "Who", "DB", "ConnID", "Dur ms", "Query");
+}
+
+mysql*:::query-start
+{
+ self->query = copyinstr(arg0);
+ self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4)));
+ self->db = copyinstr(arg2);
+ self->connid = arg1;
+ self->querystart = timestamp;
+ self->rowdur = 0;
+}
+
+mysql*:::query-done
+{
+ this->elapsed = (timestamp - self->querystart) /1000000;
+ printf("%2d %-10s %-10s %9d %9d %s\n",
+ arg0, self->who, self->db,
+ self->connid, this->elapsed, self->query);
+}
+
+mysql*:::query-done
+/ self->rowdur /
+{
+ printf("%34s %9d %s\n", "", (self->rowdur/1000000), "-> Row ops");
+}
+
+mysql*:::insert-row-start
+{
+ self->rowstart = timestamp;
+}
+
+mysql*:::delete-row-start
+{
+ self->rowstart = timestamp;
+}
+
+mysql*:::update-row-start
+{
+ self->rowstart = timestamp;
+}
+
+mysql*:::insert-row-done
+{
+ self->rowdur += (timestamp-self->rowstart);
+}
+
+mysql*:::delete-row-done
+{
+ self->rowdur += (timestamp-self->rowstart);
+}
+
+mysql*:::update-row-done
+{
+ self->rowdur += (timestamp-self->rowstart);
+}
diff --git a/support-files/dtrace/query-time.d b/support-files/dtrace/query-time.d
new file mode 100644
index 00000000..553a12b2
--- /dev/null
+++ b/support-files/dtrace/query-time.d
@@ -0,0 +1,41 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Shows basic query execution time, who execute the query, and on what database
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-20s %-20s %-40s %-9s\n", "Who", "Database", "Query", "Time(ms)");
+}
+
+mysql*:::query-start
+{
+ self->query = copyinstr(arg0);
+ self->connid = arg1;
+ self->db = copyinstr(arg2);
+ self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4)));
+ self->querystart = timestamp;
+}
+
+mysql*:::query-done
+{
+ printf("%-20s %-20s %-40s %-9d\n",self->who,self->db,self->query,
+ (timestamp - self->querystart) / 1000000);
+}
diff --git a/support-files/dtrace/statement-time.d b/support-files/dtrace/statement-time.d
new file mode 100644
index 00000000..9776e827
--- /dev/null
+++ b/support-files/dtrace/statement-time.d
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Creates a report on each query executed at the individual statement
+# level, showing rows matched, updated, and total query time
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-60s %-8s %-8s %-8s\n", "Query", "RowsU", "RowsM", "Dur (ms)");
+}
+
+mysql*:::update-start, mysql*:::insert-start,
+mysql*:::delete-start, mysql*:::multi-delete-start,
+mysql*:::multi-delete-done, mysql*:::select-start,
+mysql*:::insert-select-start, mysql*:::multi-update-start
+{
+ self->query = copyinstr(arg0);
+ self->querystart = timestamp;
+}
+
+mysql*:::insert-done, mysql*:::select-done,
+mysql*:::delete-done, mysql*:::multi-delete-done, mysql*:::insert-select-done
+/ self->querystart /
+{
+ this->elapsed = ((timestamp - self->querystart)/1000000);
+ printf("%-60s %-8d %-8d %d\n",
+ self->query,
+ 0,
+ arg1,
+ this->elapsed);
+ self->querystart = 0;
+}
+
+mysql*:::update-done, mysql*:::multi-update-done
+/ self->querystart /
+{
+ this->elapsed = ((timestamp - self->querystart)/1000000);
+ printf("%-60s %-8d %-8d %d\n",
+ self->query,
+ arg1,
+ arg2,
+ this->elapsed);
+ self->querystart = 0;
+}
diff --git a/support-files/dtrace/statement-type-aggregate.d b/support-files/dtrace/statement-type-aggregate.d
new file mode 100644
index 00000000..9d34c766
--- /dev/null
+++ b/support-files/dtrace/statement-type-aggregate.d
@@ -0,0 +1,62 @@
+#!/usr/sbin/dtrace -s
+#
+# Copyright (c) 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+#
+# Creates an aggregate report of the time spent perform queries of the four main
+# types (select, insert, update, delete)
+#
+# Report generated every 30s
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Reporting...Control-C to stop\n");
+}
+
+mysql*:::update-start, mysql*:::insert-start,
+mysql*:::delete-start, mysql*:::multi-delete-start,
+mysql*:::multi-delete-done, mysql*:::select-start,
+mysql*:::insert-select-start, mysql*:::multi-update-start
+{
+ self->querystart = timestamp;
+}
+
+mysql*:::select-done
+{
+ @statements["select"] = sum(((timestamp - self->querystart)/1000000));
+}
+
+mysql*:::insert-done, mysql*:::insert-select-done
+{
+ @statements["insert"] = sum(((timestamp - self->querystart)/1000000));
+}
+
+mysql*:::update-done, mysql*:::multi-update-done
+{
+ @statements["update"] = sum(((timestamp - self->querystart)/1000000));
+}
+
+mysql*:::delete-done, mysql*:::multi-delete-done
+{
+ @statements["delete"] = sum(((timestamp - self->querystart)/1000000));
+}
+
+tick-30s
+{
+ printa(@statements);
+}
diff --git a/support-files/magic b/support-files/magic
new file mode 100644
index 00000000..b3f3b3ea
--- /dev/null
+++ b/support-files/magic
@@ -0,0 +1,26 @@
+#
+# Add the following to the end of your /etc/magic file to get the 'file'
+# command to recognize some MySQL files.
+#
+0 beshort 0xfe01 MySQL table definition file
+>2 byte x Version %d
+0 belong&0xffffff00 0xfefe0700 MySQL MyISAM index file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0800 MySQL MyISAM compressed data file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0900 MySQL Maria index file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0A00 MySQL Maria compressed data file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0500 MySQL ISAM index file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0600 MySQL ISAM compressed data file
+>3 byte x Version %d
+0 string \376bin MySQL replication log
+0 belong&0xffffff00 0xfefe0b00
+>4 string MARIALOG MySQL Maria transaction log file
+>>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0c00
+>4 string MACF MySQL Maria control file
+>>3 byte x Version %d
+
diff --git a/support-files/mariadb.pc.in b/support-files/mariadb.pc.in
new file mode 100644
index 00000000..500e148d
--- /dev/null
+++ b/support-files/mariadb.pc.in
@@ -0,0 +1,24 @@
+# these four variables are present in almost every .pc file
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/@INSTALL_LIBDIR@
+includedir=${prefix}/@INSTALL_INCLUDEDIR@
+# its common to want to know where to install it.
+plugindir=${prefix}/@INSTALL_PLUGINDIR@
+# Below are rarely present or not at all, but we export them regardless
+bindir=${prefix}/@INSTALL_BINDIR@
+sbindir=${prefix}/@INSTALL_SBINDIR@
+scriptdir=${prefix}/@INSTALL_SCRIPTDIR@
+docdir=${prefix}/@INSTALL_DOCDIR@
+mandir=${prefix}/@INSTALL_MANDIR@
+sharedir=${prefix}/@INSTALL_SHAREDIR@
+mysqlsharedir=${prefix}/@INSTALL_MYSQLSHAREDIR@
+mysqltestdir=${prefix}/@INSTALL_MYSQLTESTDIR@
+socket=@INSTALL_UNIX_ADDRDIR@
+
+Name: @CPACK_PACKAGE_NAME@
+Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
+URL: @CPACK_PACKAGE_URL@
+Version: @VERSION@
+Libs: -L${libdir} @LIBS_FOR_CLIENTS@
+Cflags: -I${includedir} @CFLAGS_FOR_CLIENTS@
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
new file mode 100644
index 00000000..69230ec5
--- /dev/null
+++ b/support-files/mariadb.service.in
@@ -0,0 +1,169 @@
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create a file "/etc/systemd/system/mariadb.service",
+# containing
+# .include /usr/lib/systemd/system/mariadb.service
+# ...make your changes here...
+# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
+# which doesn't need to include ".include" call and which will be parsed
+# after the file mariadb.service itself is parsed.
+#
+# For more info about custom unit files, see systemd.unit(5) or
+# https://mariadb.com/kb/en/mariadb/systemd/
+#
+# Copyright notice:
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=MariaDB @VERSION@ database server
+Documentation=man:mariadbd(8)
+Documentation=https://mariadb.com/kb/en/library/systemd/
+After=network.target
+
+[Install]
+WantedBy=multi-user.target
+
+
+[Service]
+
+##############################################################################
+## Core requirements
+##
+
+Type=notify
+
+# Setting this to true can break replication and the Type=notify settings
+# See also bind-address mariadbd option.
+PrivateNetwork=false
+
+##############################################################################
+## Package maintainers
+##
+
+User=mysql
+Group=mysql
+
+# CAP_IPC_LOCK To allow memlock to be used as non-root user
+# CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
+# does nothing for non-root, not needed if /etc/shadow is u+r
+# CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
+CapabilityBoundingSet=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
+
+# PrivateDevices=true implies NoNewPrivileges=true and
+# SUID auth_pam_tool suddenly doesn't do setuid anymore
+PrivateDevices=false
+
+# Prevent writes to /usr, /boot, and /etc
+ProtectSystem=full
+
+# Doesn't yet work properly with SELinux enabled
+# NoNewPrivileges=true
+
+# Prevent accessing /home, /root and /run/user
+ProtectHome=true
+
+# Execute pre and post scripts as root, otherwise it does it as User=
+PermissionsStartOnly=true
+
+@SYSTEMD_EXECSTARTPRE@
+
+# Perform automatic wsrep recovery. When server is started without wsrep,
+# galera_recovery simply returns an empty string. In any case, however,
+# the script is not expected to return with a non-zero status.
+# It is always safe to unset _WSREP_START_POSITION environment variable.
+# Do not panic if galera_recovery script is not available. (MDEV-10538)
+ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
+ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
+ VAR=`cd @bindir@/..; @bindir@/galera_recovery`; [ $? -eq 0 ] \
+ && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
+
+# Needed to create system tables etc.
+# ExecStartPre=@scriptdir@/mysql_install_db -u mysql
+
+# Start main service
+# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
+# Use the [Service] section and Environment="MYSQLD_OPTS=...".
+# This isn't a replacement for my.cnf.
+# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
+ExecStart=@sbindir@/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
+
+# Unset _WSREP_START_POSITION environment variable.
+ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
+
+@SYSTEMD_EXECSTARTPOST@
+
+KillSignal=SIGTERM
+
+# Don't want to see an automated SIGKILL ever
+SendSIGKILL=no
+
+# Restart crashed server only, on-failure would also restart, for example, when
+# my.cnf contains unknown option
+Restart=on-abort
+RestartSec=5s
+
+UMask=007
+
+##############################################################################
+## USERs can override
+##
+##
+## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
+## and adding/setting the following under [Service] will override this file's
+## settings.
+
+# Useful options not previously available in [mysqld_safe]
+
+# Kernels like killing mariadbd when out of memory because its big.
+# Lets temper that preference a little.
+# OOMScoreAdjust=-600
+
+# Explicitly start with high IO priority
+# BlockIOWeight=1000
+
+# If you don't use the /tmp directory for SELECT ... OUTFILE and
+# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
+PrivateTmp=false
+
+# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
+# this is the same value as used in SysV init scripts in the past
+# Galera might need a longer timeout, check the KB if you want to change this:
+# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
+TimeoutStartSec=900
+TimeoutStopSec=900
+
+##
+## Options previously available to be set via [mysqld_safe]
+## that now needs to be set by systemd config files as mysqld_safe
+## isn't executed.
+##
+
+# Number of files limit. previously [mysqld_safe] open-files-limit
+LimitNOFILE=32768
+
+# Maximium core size. previously [mysqld_safe] core-file-size
+# LimitCore=
+
+# Nice priority. previously [mysqld_safe] nice
+# Nice=-5
+
+# Timezone. previously [mysqld_safe] timezone
+# Environment="TZ=UTC"
+
+# Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
+# (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
+# Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
+
+# Flush caches. previously [mysqld_safe] flush-caches=1
+# ExecStartPre=sync
+# ExecStartPre=sysctl -q -w vm.drop_caches=3
+
+# numa-interleave=1 equalivant
+# Change ExecStart=numactl --interleave=all @sbindir@/mariadbd......
+
+# crash-script equalivent
+# FailureAction=
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
new file mode 100644
index 00000000..d510bfef
--- /dev/null
+++ b/support-files/mariadb@.service.in
@@ -0,0 +1,294 @@
+# Multi instance version of MariaDB
+#
+# Use this if you run multiple instances of MariaDB on a single server.
+#
+# This systemd service is not suitable for Galera as specialised SST recovery
+# scripts are needed.
+#
+#
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create a file "/etc/systemd/system/mariadb@.service",
+# containing
+# .include /usr/lib/systemd/system/mariadb@.service
+# ...make your changes here...
+# or create a file "/etc/systemd/system/mariadb@.service.d/foo.conf",
+# which doesn't need to include ".include" call and which will be parsed
+# after the file mariadb@.service itself is parsed.
+#
+# For more info about custom unit files, see systemd.unit(5) or
+# https://mariadb.com/kb/en/mariadb/systemd/
+#
+# Copyright notice:
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+#
+# MULTI INSTANCES
+#
+# When multiple instances of MariaDB are running on a server they need to
+# ensure that they don't conflict with each other. This includes elements
+# like network ports, sockets and data directories listed under CONFLICTING
+# VARIABLES below. The systemd environment variable MYSQLD_MULTI_INSTANCE
+# controls each instance to ensure it is run independently. It is passed to
+# mariadbd and mysql_install
+#
+# By default, a group suffix exists and within the default configuration
+# files, a group [mariadbd.{instancename}] is read for each service. Other
+# default groups, like [server.{instancename}] and [mariadb.{instancename}],
+# are also read. For each instance, one of the groups will need to contain
+# the conflicting variables listed below under CONFLICTING VARIABLES.
+#
+# The MYSQLD_MULTI_INSTANCE environment used is:
+# Environment='MYSQLD_MULTI_INSTANCE=--defaults-group-suffix=.%I --basedir=@prefix@'
+#
+#
+# APPLYING YOUR MULTI INSTANCE MECHANISM
+#
+# To apply one of the non-default multi-instance mechanisms, create a file
+# "/etc/systemd/system/mariadb@.service.d/multi.conf" containing:
+#
+# [Service]
+# Environment=MYSQLD_MULTI_INSTANCE="...."
+#
+# Include any other settings you which to override. Directives like Exec* are
+# lists and adding a directive will append to the list. You can clear the list
+# by starting with "Directive=" and no value. Follow this by the list that you
+# do want. See the systemd.unit(5) manual page for more information.
+#
+# Then run "systemctl daemon-reload".
+#
+#
+# EXAMPLE MYSQLD_MULTI_INSTANCE CONFIGURATIONS
+#
+# Configuration File Based Mechanism:
+#
+# This has a configuration file per instance.
+#
+# [Unit]
+# ConditionPathExists=@sysconfdir@/my.%I.cnf
+#
+# [Service]
+# Environment=MYSQLD_MULTI_INSTANCE=--defaults-file=@sysconfdir@/my.%I.cnf
+#
+# Here you need to create a configuration file @sysconfdir@/my.%I.cnf for each
+# instance, each containing the conflicting variables to separate instances.
+#
+#
+# Multi User Based Mechanism:
+#
+# Here each user (the instance name) has their own mysql instance.
+#
+# Create instances in users home directory with abstract socket:
+#
+# [Service]
+# User=%I
+# ProtectHome=false
+# ExecStartPre=
+# ExecStartPre=@scriptdir@/mysql_install_db $MYSQLD_MULTI_INSTANCE \
+# --auth-root-authentication-method=socket --auth-root-socket-user=%I
+# Environment=MYSQLD_MULTI_INSTANCE="--defaults-file=/home/%I/my%I.cnf \
+# --datadir=/home/%I/mysqldatadir --skip-networking --socket=@mysql-%I"
+#
+#
+# Command Line Mechanism:
+#
+# This is a good way run multiple instance where there is little difference
+# in configuration between instances.
+#
+# [Service]
+# Environment=MYSQLD_MULTI_INSTANCE="--socket=/run/mysqld/%I.sock \
+# --datadir=/var/lib/mysqld-multi/%I \
+# --skip-networking"
+#
+#
+# CONFLICTING VARIABLES
+#
+# A number of MariaDB system variables may conflict. The main ones that need to
+# be set because their default values will conflict are:
+# * socket
+# * port
+# * datadir
+#
+#
+# PRE-10.4
+#
+# Before 10.4 MYSQLD_MULTI_INSTANCE was effectively --defaults-file=@sysconf2dir@/my%I.cnf
+# As @sysconfdir@/my.cnf included these files it was a bad choice as an
+# existing single instance would include all these files. If you want to
+# continue a file based multi-instance mariadbd, recommend the Configuration File
+# Based Mechanism above and moving @sysconf2dir@/my%I.cnf files to @sysconfdir@/my%I.cnf.
+#
+#
+# SELINUX
+#
+# As basic selinux rules are written around a single instance of MariaDB you may need
+# to define labels for the files and network ports of all instances.
+#
+# See: https://mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start/#selinux
+#
+#
+# STARTING
+#
+# Start the instance: systemctl start mariadb@{instancename}.service
+#
+#
+# DOCUMENTATION:
+#
+# Read https://mariadb.com/kb/en/mariadb/systemd/ regarding customisation.
+#
+# Also see systemd man pages: systemd.unit(5), systemd.exec(5) and
+# systemd.service(5)
+
+[Unit]
+Description=MariaDB @VERSION@ database server (multi-instance %I)
+Documentation=man:mariadbd(8)
+Documentation=https://mariadb.com/kb/en/library/systemd/
+After=network.target
+
+# Negated condition here is because 10.3 and before had @sysconf2dir@/my%I.cnf
+# as the configuration difference for multiple instances. This condition here
+# to prevent an accidental change during an upgrade in the case the user
+# created these file(s).
+#
+## See Environment=MYSQLD_MULTI_INSTANCE below for current recommended options.
+ConditionPathExists=!@sysconf2dir@/my%I.cnf
+
+
+[Install]
+WantedBy=multi-user.target
+
+
+[Service]
+##############################################################################
+## Core requirements
+##
+
+Type=notify
+
+# Setting this to true can break replication and the Type=notify settings
+# See also bind-address mariadbd option.
+PrivateNetwork=false
+
+##############################################################################
+## Package maintainers
+##
+
+# CAP_IPC_LOCK To allow memlock to be used as non-root user
+# CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
+# does nothing for non-root, not needed if /etc/shadow is u+r
+# CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
+CapabilityBoundingSet=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
+
+# PrivateDevices=true implies NoNewPrivileges=true and
+# SUID auth_pam_tool suddenly doesn't do setuid anymore
+PrivateDevices=false
+
+# Prevent writes to /usr, /boot, and /etc
+ProtectSystem=full
+
+# Requires kernel 4.14 or later and SELinux transition rule for mysqld_t
+# (https://github.com/systemd/systemd/issues/3845)
+# NoNewPrivileges=true
+
+# Prevent accessing /home, /root and /run/user
+ProtectHome=true
+
+# Needed to create system tables etc.
+ExecStartPre=@scriptdir@/mysql_install_db $MYSQLD_MULTI_INSTANCE
+
+# Start main service
+# A few variables are here:
+# * MYSQLD_MULTI_INSTANCE - control how multiple instances are distinguisable
+# * MYSQLD_OPTS - user definable extras - not a replacement for my.cnf
+#
+# Note 1: Place $MYSQLD_OPTS at the very end for its options to take precedence.
+ExecStart=@sbindir@/mariadbd $MYSQLD_MULTI_INSTANCE $MYSQLD_OPTS
+
+@SYSTEMD_EXECSTARTPOST@
+
+KillSignal=SIGTERM
+
+# Don't want to see an automated SIGKILL ever
+SendSIGKILL=no
+
+# Restart crashed server only, on-failure would also restart, for example, when
+# my.cnf contains unknown option
+Restart=on-abort
+RestartSec=5s
+
+UMask=007
+
+##############################################################################
+## USERs can override
+##
+##
+## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
+## and adding/setting the following below [Service] will override this file's
+## settings.
+
+# Useful options not previously available in [mysqld_safe]
+
+# Kernels like killing mariadbd when out of memory because its big.
+# Lets temper that preference a little.
+# OOMScoreAdjust=-600
+
+# Explicitly start with high IO priority
+# BlockIOWeight=1000
+
+# If you don't use the /tmp directory for SELECT ... OUTFILE and
+# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
+PrivateTmp=false
+
+# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
+# this is the same value as used in SysV init scripts in the past
+# if you need a longer timeout, check the KB:
+# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
+TimeoutStartSec=900
+TimeoutStopSec=900
+
+# Controlling how multiple instances are separated. See top of this file.
+# Note: This service isn't User=mysql by default so we need to be explicit.
+# It is as an option here as a user may want to use the MYSQLD_MULTI_INSTANCE
+# to run multiple versions.
+Environment='MYSQLD_MULTI_INSTANCE=--defaults-group-suffix=.%I'
+
+# While you can override these, you shouldn't leave them empty as that
+# will default to root.
+User=mysql
+Group=mysql
+
+##
+## Options previously available to be set via [mysqld_safe]
+## that now needs to be set by systemd config files as mysqld_safe
+## isn't executed.
+##
+
+# Number of files limit. previously [mysqld_safe] open-files-limit
+LimitNOFILE=32768
+
+# Maximium core size. previously [mysqld_safe] core-file-size
+# LimitCore=
+
+# Nice priority. previously [mysqld_safe] nice
+# Nice=-5
+
+# Timezone. previously [mysqld_safe] timezone
+# Environment="TZ=UTC"
+
+# Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
+# (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
+# Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
+
+# Flush caches. previously [mysqld_safe] flush-caches=1
+# ExecStartPre=sync
+# ExecStartPre=sysctl -q -w vm.drop_caches=3
+
+# numa-interleave=1 equalivant
+# Change ExecStart=numactl --interleave=all @sbindir@/mariadbd......
+
+# crash-script equalivent
+# FailureAction=
diff --git a/support-files/mysql-log-rotate.sh b/support-files/mysql-log-rotate.sh
new file mode 100644
index 00000000..37ae018c
--- /dev/null
+++ b/support-files/mysql-log-rotate.sh
@@ -0,0 +1,37 @@
+# This logname can be set in /etc/my.cnf
+# by setting the variable "log-error"
+# in the [mysqld] section as follows:
+#
+# [mysqld]
+# log-error=@localstatedir@/mysqld.log
+#
+# If the root user has a password you have to create a
+# /root/.my.cnf configuration file with the following
+# content:
+#
+# [mysqladmin]
+# password = <secret>
+# user= root
+#
+# where "<secret>" is the password.
+#
+# ATTENTION: This /root/.my.cnf should be readable ONLY
+# for root !
+
+@localstatedir@/mysqld.log {
+ # create 600 mysql mysql
+ notifempty
+ daily
+ rotate 3
+ missingok
+ compress
+ postrotate
+ # just if mariadbd is really running
+ if test -x @bindir@/mysqladmin && \
+ @bindir@/mysqladmin ping &>/dev/null
+ then
+ @bindir@/mysqladmin --local flush-error-log \
+ flush-engine-log flush-general-log flush-slow-log
+ fi
+ endscript
+}
diff --git a/support-files/mysql-multi.server.sh b/support-files/mysql-multi.server.sh
new file mode 100644
index 00000000..a7a51e6a
--- /dev/null
+++ b/support-files/mysql-multi.server.sh
@@ -0,0 +1,192 @@
+#!/bin/sh
+# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
+# This file is public domain and comes with NO WARRANTY of any kind
+
+# Mysql daemon start/stop script. Multi-instance enhancements by Tim Bunce.
+
+# Usually this is put in /etc/init.d (at least on machines SYSV R4
+# based systems) and linked to
+# /etc/rc3.d/S99mysql.svr1
+# and /etc/rc0.d/S01mysql.svr1
+# When this is done the mysql server will be started when the machine is
+# started and shut down when the systems goes down. The '.svr1' suffix can
+# be used to identify one of a number of servers. Multiple symlinks can be
+# created, one per instance. The 'svrN' suffix can then be used to
+# prefix configuration variables in a separate section of /etc/my.cnf.
+# See example below.
+#
+# A typical multi-instance /etc/my.cnf file would look like:
+# [mysqld]
+# basedir=...
+# key_buffer_size=16M
+# max_allowed_packet=1M
+# [mysql_multi_server]
+# svr1-datadir=/foo1/bar
+# svr2-datadir=/foo2/bar
+#
+# and then the /foo1/bar/my.cnf and /foo2/bar/my.cnf files
+# would contain all the *instance specific* configurations.
+#
+# This script can also be run manually in which case the server instance
+# is identified by an extra argument, for example:
+# /etc/init.d/mysql stop svr3
+#
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+export PATH
+
+mode=$1 # start or stop
+svr=$2 # eg 'svr1' (optional)
+if [ "$2" = "" ]
+then name=`basename $0`
+else name=$2
+fi
+
+# Extract identity of the server we are working with
+svr=`echo "$name" | sed -e 's/.*\<\(svr[1-9][0-9]*\)\>.*/\1/'`
+if [ "$svr" = "" ]
+then
+ echo "Can't determine database svr number from name '$name'"
+ exit 1
+fi
+
+echo "mariadbd $svr $mode"
+
+parse_arguments() {
+ for arg do
+ case "$arg" in
+ --basedir=*|--${svr}-basedir=*)
+ basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --datadir=*|--${svr}-basedir=*)
+ datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --pid-file=*|--${svr}-basedir=*)
+ pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ esac
+ done
+}
+
+# Get arguments from the my.cnf file, groups [mysqld], [mysql_server],
+# and mysql_multi_server
+if test -x ./bin/my_print_defaults
+then
+ print_defaults="./bin/my_print_defaults"
+elif test -x @bindir@/my_print_defaults
+then
+ print_defaults="@bindir@/my_print_defaults"
+elif test -x @bindir@/mysql_print_defaults
+then
+ print_defaults="@bindir@/mysql_print_defaults"
+else
+ # Try to find basedir in /etc/my.cnf
+ conf=/etc/my.cnf
+ print_defaults=
+ if test -r $conf
+ then
+ subpat='^[^=]*basedir[^=]*=\(.*\)$'
+ dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf
+ for d in $dirs
+ do
+ d=`echo $d | sed -e 's/[ ]//g'`
+ if test -x "$d/bin/my_print_defaults"
+ then
+ print_defaults="$d/bin/my_print_defaults"
+ break
+ fi
+ if test -x "$d/bin/mysql_print_defaults"
+ then
+ print_defaults="$d/bin/mysql_print_defaults"
+ break
+ fi
+ done
+ fi
+
+ # Hope it's in the PATH ... but I doubt it
+ test -z "$print_defaults" && print_defaults="my_print_defaults"
+fi
+
+datadir=@localstatedir@
+basedir=
+pid_file=
+parse_arguments `$print_defaults $defaults mariadbd mysqld mysql_server mysql_multi_server`
+
+if test -z "$basedir"
+then
+ basedir=@prefix@
+ bindir=@bindir@
+else
+ bindir="$basedir/bin"
+fi
+if test -z "$pid_file"
+then
+ pid_file=$datadir/`@HOSTNAME@`.pid
+else
+ case "$pid_file" in
+ /* ) ;;
+ * ) pid_file="$datadir/$pid_file" ;;
+ esac
+fi
+
+# Safeguard (relative paths, core dumps..)
+cd $basedir
+
+case "$mode" in
+ 'start')
+ # Start daemon
+
+ if test -x $bindir/mysqld_safe
+ then
+ # We only need to specify datadir and pid-file here and we
+ # get all other instance-specific config from $datadir/my.cnf.
+ # We have to explicitly pass --defaults-extra-file because it
+ # reads the config files before the command line options.
+ # Also it must be first because of the way mysqld_safe works.
+ $bindir/mysqld_safe --defaults-extra-file=$datadir/my.cnf \
+ --datadir=$datadir --pid-file=$pid_file &
+ # Make lock for RedHat / SuSE
+ if test -d /var/lock/subsys
+ then
+ touch /var/lock/subsys/mysql
+ fi
+ else
+ echo "Can't execute $bindir/mysqld_safe"
+ fi
+ ;;
+
+ 'stop')
+ # Stop daemon. We use a signal here to avoid having to know the
+ # root password.
+ if test -f "$pid_file"
+ then
+ mariadbd_pid=`cat $pid_file`
+ echo "Killing mariadbd $svr with pid $mariadbd_pid"
+ kill $mariadbd_pid
+ # mariadbd should remove the pid_file when it exits, so wait for it.
+
+ sleep 1
+ while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
+ do
+ [ -z "$flags" ] && echo "Wait for mariadbd $svr to exit\c" || echo ".\c"
+ flags=a$flags
+ sleep 1
+ done
+ if [ -s $pid_file ]
+ then echo " gave up waiting!"
+ elif [ -n "$flags" ]
+ then echo " done"
+ fi
+ # delete lock for RedHat / SuSE
+ if test -e /var/lock/subsys/mysql
+ then
+ rm /var/lock/subsys/mysql
+ fi
+ else
+ echo "No mariadbd pid file found. Looked for $pid_file."
+ fi
+ ;;
+
+ *)
+ # usage
+ echo "usage: $0 start|stop [ svrN ]"
+ exit 1
+ ;;
+esac
diff --git a/support-files/mysql.m4 b/support-files/mysql.m4
new file mode 100644
index 00000000..0a7034f6
--- /dev/null
+++ b/support-files/mysql.m4
@@ -0,0 +1,109 @@
+# Copyright (C) 2007 MySQL AB
+# Use is subject to license terms
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+AC_DEFUN([_MYSQL_CONFIG],[
+ AC_ARG_WITH([mysql-config],
+ AS_HELP_STRING([--with-mysql-config=PATH], [A path to mysql_config script]),
+ [mysql_config="$withval"], [mysql_config=mysql_config])
+])
+
+dnl
+dnl Usage:
+dnl
+dnl MYSQL_CLIENT([version], [client|thread-safe|embedded])
+dnl
+dnl Two optional arguments:
+dnl first: The minimal version of the MySQL to use
+dnl if not specified, any version will be accepted.
+dnl The version should be specified as three numbers,
+dnl without suffixes. E.g. 4.10.15 or 5.0.3
+dnl second: force the specified library flavor to be selected,
+dnl if not specified, a user will be able to choose
+dnl between client (non-thread-safe) and embedded
+dnl
+dnl On successful execution sets MYSQL_CLIENT_CFLAGS and
+dnl MYSQL_CLIENT_LIBS shell variables and makes substitutions
+dnl out of them (calls AC_SUBST)
+dnl
+
+AC_DEFUN([MYSQL_CLIENT],[
+ AC_REQUIRE([_MYSQL_CONFIG])
+ AC_MSG_CHECKING([for MySQL])
+ ifelse([$2], [client],
+ [mysql_libs=--libs mysql_cflags=--cflags],
+ [$2], [thread-safe],
+ [mysql_libs=--libs_r mysql_cflags=--cflags],
+ [$2], [embedded],
+ [mysql_libs=--libmysqld-libs mysql_cflags=--cflags],
+ [$2], [], [
+ AC_ARG_WITH([mysql-library],
+ AS_HELP_STRING([--with-mysql-library], ['client' or 'embedded']),
+ [mysql_lib="$withval"], [mysql_lib=client])
+[
+ case "$mysql_lib" in
+ client) mysql_libs=--libs mysql_cflags=--cflags ;;
+ embedded) mysql_libs=--libmysqld-libs mysql_cflags=--cflags ;;
+ *) ]AC_MSG_ERROR([Bad value for --with-mysql-library])[
+ esac
+]
+ ],
+ [AC_FATAL([Bad second (library flavor) argument to MYSQL_CLIENT])])
+[
+ mysql_version=`$mysql_config --version`
+ if test -z "$mysql_version" ; then
+ ]AC_MSG_ERROR([Cannot execute $mysql_config])[
+ fi
+]
+ ifelse([$1], [], [], [
+ ifelse(regexp([$1], [^[0-9][0-9]?\.[0-9][0-9]?\.[0-9][0-9]?$]), -1,
+ [AC_FATAL([Bad first (version) argument to MYSQL_CLIENT])], [
+dnl
+dnl Transformation below works as follows:
+dnl assume, we have a number 1.2.3-beta
+dnl *a* line removes the suffix and adds first and last dot to the version:
+dnl .1.2.3.
+dnl *b* line adds a 0 to a "single digit surrounded by dots"
+dnl .01.2.03.
+dnl note that the pattern that matched .1. has eaten the dot for .2.
+dnl and 2 still has no 0
+dnl *c* we repeat the same replacement as in *b*, matching .2. this time
+dnl .01.02.03.
+dnl the last replacement removes all dots
+dnl 010203
+dnl giving us a number we can compare with
+dnl
+ mysql_ver=`echo ${mysql_version}|dnl
+ sed 's/[[-a-z]].*//; s/.*/.&./;dnl *a*
+ s/\.\([[0-9]]\)\./.0\1./g;dnl *b*
+ s/\.\([[0-9]]\)\./.0\1./g;dnl *c*
+ s/\.//g'`
+ if test "$mysql_ver" -lt]dnl
+dnl the same as sed transformation above, without suffix-stripping, in m4
+ patsubst(patsubst(patsubst(.[$1]., [\.\([0-9]\)\.], [.0\1.]), [\.\([0-9]\)\.], [.0\1.]), [\.], [])[ ; then
+ AC_MSG_ERROR([MySQL version $mysql_version is too low, minimum of $1 is required])
+ fi
+ ])])
+
+ MYSQL_CLIENT_CFLAGS=`$mysql_config $mysql_cflags`
+ MYSQL_CLIENT_LIBS=`$mysql_config $mysql_libs`
+ AC_SUBST(MYSQL_CLIENT_CFLAGS)
+ AC_SUBST(MYSQL_CLIENT_LIBS)
+
+ # should we try to build a test program ?
+
+ AC_MSG_RESULT([$mysql_version])
+])
+
diff --git a/support-files/mysql.server-sys5.sh b/support-files/mysql.server-sys5.sh
new file mode 100644
index 00000000..3049b43d
--- /dev/null
+++ b/support-files/mysql.server-sys5.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# This is an example SysV-init-script by Winfried Truemper that you can use
+# and modify to your liking
+#
+
+PATH="$PATH:@prefix@"
+export PATH
+MY_CFG="@prefix@/mysql.cfg"
+
+read_mysql_config() {
+ # this routine requires a sed, which reads even the last line of input
+
+ MY_CONFIG_FILE="$1" # file to read setting from
+ MY_CONFIG_SECTION="$2" # section inside the file
+ MY_CONFIG_TAG="$3" # name of the setting inside the section
+ TAB=`printf "\t" ""` # makes the code cut&paste safe
+
+ sed -n -f - "$MY_CONFIG_FILE" <<EOF
+1,/^\[$MY_CONFIG_SECTION\]/ d
+/^\[[a-z]/ q
+/^$MY_CONFIG_TAG/ {
+s/^$MY_CONFIG_TAG[ $TAB]*=[ $TAB]*\([^ $TAB]*\)/\1/
+p
+q
+}
+EOF
+}
+
+
+
+do_start() {
+ nohup ./bin/mariadbd --defaults-file="$MY_CFG" &
+}
+
+do_stop() {
+ ./bin/mysqladmin --defaults-file="$MY_CFG" shutdown
+}
+
+do_kill_all() {
+ PIDS=`ps -efo pid,args | grep mysql | sed -e "s, *.*,," | sort | uniq`
+ kill $PIDS
+ sleep 5
+ kill -9 $PIDS
+}
+
+do_kill() {
+ MY_PIDFILE=`read_mysql_config "$MY_CFG" "mariadbd" "pidfile" `
+ read MY_PID < "$MY_PIDFILE"
+ kill "$MY_PID"
+ sleep 2
+ kill -KILL "$MY_PID"
+}
+
+# z.B. mysql.sh admin "ping"
+do_admin() {
+ shift
+ ./bin/mysqladmin --defaults-file="$MY_CFG" $@
+ exit
+}
+
+do_repair() {
+ MY_DATADIR=`read_mysql_config "$MY_CFG" "mariadbd" "datadir" `
+ ./bin/isamchk --defaults-file="$MY_CFG" --repair "$MY_DATADIR/$1"
+ shift
+}
+
+
+do_repair_all() {
+ MY_DATADIR=`read_mysql_config "$MY_CFG" "mariadbd" "datadir" `
+ for i in `find "$MY_DATADIR" -name "*.ISM"`
+ do
+ ./bin/isamchk --defaults-file="$MY_CFG" --repair "$MY_DATADIR/$i"
+ done
+}
+
+
+
+MY_BASEDIR=`read_mysql_config "$MY_CFG" "mariadbd" "basedir"`
+cd "$MY_BASEDIR" || exit 1
+while test $# -gt 0
+do
+ MY_ARG="$1"
+ do_$MY_ARG $@
+ shift
+done
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
new file mode 100644
index 00000000..cbd6b472
--- /dev/null
+++ b/support-files/mysql.server.sh
@@ -0,0 +1,457 @@
+#!/bin/sh
+# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
+# This file is public domain and comes with NO WARRANTY of any kind
+
+# MariaDB daemon start/stop script.
+
+# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
+# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
+# When this is done the mysql server will be started when the machine is
+# started and shut down when the systems goes down.
+
+# Comments to support chkconfig on RedHat Linux
+# chkconfig: 2345 64 36
+# description: A very fast and reliable SQL database engine.
+
+# Comments to support LSB init script conventions
+### BEGIN INIT INFO
+# Provides: mysql
+# Required-Start: $local_fs $network $remote_fs
+# Should-Start: ypbind nscd ldap ntpd xntpd
+# Required-Stop: $local_fs $network $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop MariaDB
+# Description: MariaDB is a very fast and reliable SQL database engine.
+### END INIT INFO
+
+# have to do one of the following things for this script to work:
+#
+# - Run this script from within the MariaDB installation directory
+# - Create a /etc/my.cnf file with the following information:
+# [mysqld]
+# basedir=<path-to-mysql-installation-directory>
+# - Add the above to any other configuration file (for example ~/.my.ini)
+# and copy my_print_defaults to /usr/bin
+# - Add the path to the mysql-installation-directory to the basedir variable
+# below.
+#
+# If you want to affect other MariaDB variables, you should make your changes
+# in the /etc/my.cnf, ~/.my.cnf or other MariaDB configuration files.
+
+# If you change base dir, you must also change datadir. These may get
+# overwritten by settings in the MariaDB configuration files.
+
+basedir=
+datadir=
+
+# Default value, in seconds, afterwhich the script should timeout waiting
+# for server start.
+# Value here is overridden by value in my.cnf.
+# 0 means don't wait at all
+# Negative numbers mean to wait indefinitely
+service_startup_timeout=900
+
+# Lock directory for RedHat / SuSE.
+lockdir='/var/lock/subsys'
+lock_file_path="$lockdir/mysql"
+
+# The following variables are only set for letting mysql.server find things.
+
+# Set some defaults
+mariadbd_pid_file_path=
+if test -z "$basedir"
+then
+ basedir=@prefix@
+ bindir=@bindir@
+ if test -z "$datadir"
+ then
+ datadir=@localstatedir@
+ fi
+ sbindir=@sbindir@
+ libexecdir=@libexecdir@
+else
+ bindir="$basedir/bin"
+ if test -z "$datadir"
+ then
+ datadir="$basedir/data"
+ fi
+ sbindir="$basedir/sbin"
+ if test -f "$basedir/bin/mariadbd"
+ then
+ libexecdir="$basedir/bin"
+ else
+ libexecdir="$basedir/libexec"
+ fi
+fi
+
+# datadir_set is used to determine if datadir was set (and so should be
+# *not* set inside of the --basedir= handler.)
+datadir_set=
+
+#
+# Use LSB init script functions for printing messages, if possible
+#
+lsb_functions="/lib/lsb/init-functions"
+if test -f $lsb_functions ; then
+ . $lsb_functions
+else
+ # Include non-LSB RedHat init functions to make systemctl redirect work
+ init_functions="/etc/init.d/functions"
+ if test -f $init_functions; then
+ . $init_functions
+ fi
+ log_success_msg()
+ {
+ echo " SUCCESS! $@"
+ }
+ log_failure_msg()
+ {
+ echo " ERROR! $@"
+ }
+fi
+
+PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
+export PATH
+
+mode=$1 # start or stop
+
+[ $# -ge 1 ] && shift
+
+case `echo "testing\c"`,`echo -n testing` in
+ *c*,-n*) echo_n= echo_c= ;;
+ *c*,*) echo_n=-n echo_c= ;;
+ *) echo_n= echo_c='\c' ;;
+esac
+
+parse_server_arguments() {
+ for arg do
+ val=`echo "$arg" | sed -e 's/^[^=]*=//'`
+ case "$arg" in
+ --basedir=*) basedir="$val"
+ bindir="$basedir/bin"
+ if test -z "$datadir_set"; then
+ datadir="$basedir/data"
+ fi
+ sbindir="$basedir/sbin"
+ if test -f "$basedir/bin/mariadbd"
+ then
+ libexecdir="$basedir/bin"
+ else
+ libexecdir="$basedir/libexec"
+ fi
+ libexecdir="$basedir/libexec"
+ ;;
+ --datadir=*) datadir="$val"
+ datadir_set=1
+ ;;
+ --log-basename=*|--hostname=*|--loose-log-basename=*)
+ mariadbd_pid_file_path="$val.pid"
+ ;;
+ --pid-file=*) mariadbd_pid_file_path="$val" ;;
+ --service-startup-timeout=*) service_startup_timeout="$val" ;;
+ --user=*) user="$val"; ;;
+ esac
+ done
+}
+
+# Get arguments from the my.cnf file,
+# the only group, which is read from now on is [mysqld]
+if test -x "$bindir/my_print_defaults"; then
+ print_defaults="$bindir/my_print_defaults"
+else
+ # Try to find basedir in /etc/my.cnf
+ conf=/etc/my.cnf
+ print_defaults=
+ if test -r $conf
+ then
+ subpat='^[^=]*basedir[^=]*=\(.*\)$'
+ dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
+ for d in $dirs
+ do
+ d=`echo $d | sed -e 's/[ ]//g'`
+ if test -x "$d/bin/my_print_defaults"
+ then
+ print_defaults="$d/bin/my_print_defaults"
+ break
+ fi
+ done
+ fi
+
+ # Hope it's in the PATH ... but I doubt it
+ test -z "$print_defaults" && print_defaults="my_print_defaults"
+fi
+
+user='@MYSQLD_USER@'
+
+su_kill() {
+ if test "$USER" = "$user"; then
+ kill $* >/dev/null 2>&1
+ else
+ su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
+ fi
+}
+
+#
+# Read defaults file from 'basedir'. If there is no defaults file there
+# check if it's in the old (depricated) place (datadir) and read it from there
+#
+
+extra_args=""
+if test -r "$basedir/my.cnf"
+then
+ extra_args="--defaults-extra-file= $basedir/my.cnf"
+else
+ if test -r "$datadir/my.cnf"
+ then
+ extra_args="--defaults-extra-file= $datadir/my.cnf"
+ fi
+fi
+
+parse_server_arguments `$print_defaults $extra_args --mysqld mysql.server`
+parse_server_arguments "$@"
+
+# wait for the pid file to disappear
+wait_for_gone () {
+ pid="$1" # process ID of the program operating on the pid-file
+ pid_file_path="$2" # path to the PID file.
+
+ i=0
+ crash_protection="by checking again"
+
+ while test $i -ne $service_startup_timeout ; do
+
+ if su_kill -0 "$pid" ; then
+ : # the server still runs
+ else
+ if test ! -s "$pid_file_path"; then
+ # no server process and no pid-file? great, we're done!
+ log_success_msg
+ return 0
+ fi
+
+ # pid-file exists, the server process doesn't.
+ # it must've crashed, and mysqld_safe will restart it
+ if test -n "$crash_protection"; then
+ crash_protection=""
+ sleep 5
+ continue # Check again.
+ fi
+
+ # Cannot help it
+ log_failure_msg "The server quit without updating PID file ($pid_file_path)."
+ return 1 # not waiting any more.
+ fi
+
+ echo $echo_n ".$echo_c"
+ i=`expr $i + 1`
+ sleep 1
+
+ done
+
+ log_failure_msg
+ return 1
+}
+
+wait_for_ready () {
+
+ i=0
+ while test $i -ne $service_startup_timeout ; do
+
+ if $bindir/mysqladmin ping >/dev/null 2>&1; then
+ log_success_msg
+ return 0
+ elif kill -0 $! ; then
+ : # mysqld_safe is still running
+ else
+ # mysqld_safe is no longer running, abort the wait loop
+ break
+ fi
+
+ echo $echo_n ".$echo_c"
+ i=`expr $i + 1`
+ sleep 1
+
+ done
+
+ log_failure_msg
+ return 1
+}
+#
+# Set pid file if not given
+#
+if test -z "$mariadbd_pid_file_path"
+then
+ mariadbd_pid_file_path=$datadir/`@HOSTNAME@`.pid
+else
+ case "$mariadbd_pid_file_path" in
+ /* ) ;;
+ * ) mariadbd_pid_file_path="$datadir/$mariadbd_pid_file_path" ;;
+ esac
+fi
+
+# source other config files
+[ -f /etc/default/mysql ] && . /etc/default/mysql
+[ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql
+[ -f /etc/conf.d/mysql ] && . /etc/conf.d/mysql
+
+case "$mode" in
+ 'start')
+ # Start daemon
+
+ # Safeguard (relative paths, core dumps..)
+ cd $basedir
+
+ echo $echo_n "Starting MariaDB"
+ if test -x $bindir/mysqld_safe
+ then
+ # Give extra arguments to mysqld with the my.cnf file. This script
+ # may be overwritten at next upgrade.
+ $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mariadbd_pid_file_path" "$@" &
+ wait_for_ready; return_value=$?
+
+ # Make lock for RedHat / SuSE
+ if test -w "$lockdir"
+ then
+ touch "$lock_file_path"
+ fi
+
+ exit $return_value
+ else
+ log_failure_msg "Couldn't find MariaDB server ($bindir/mysqld_safe)"
+ fi
+ ;;
+
+ 'stop')
+ # Stop daemon. We use a signal here to avoid having to know the
+ # root password.
+
+ if test -s "$mariadbd_pid_file_path"
+ then
+ mariadbd_pid=`cat "$mariadbd_pid_file_path"`
+
+ if su_kill -0 $mariadbd_pid ; then
+ echo $echo_n "Shutting down MariaDB"
+ su_kill $mariadbd_pid
+ # mysqld should remove the pid file when it exits, so wait for it.
+ wait_for_gone $mariadbd_pid "$mariadbd_pid_file_path"; return_value=$?
+ else
+ log_failure_msg "MariaDB server process #$mariadbd_pid is not running!"
+ rm "$mariadbd_pid_file_path"
+ fi
+
+ # Delete lock for RedHat / SuSE
+ if test -f "$lock_file_path"
+ then
+ rm -f "$lock_file_path"
+ fi
+ exit $return_value
+ else
+ log_failure_msg "MariaDB server PID file could not be found!"
+ fi
+ ;;
+
+ 'restart')
+ # Stop the service and regardless of whether it was
+ # running or not, start it again.
+ if $0 stop "$@"; then
+ if ! $0 start "$@"; then
+ log_failure_msg "Failed to restart server."
+ exit 1
+ fi
+ else
+ log_failure_msg "Failed to stop running server, so refusing to try to start."
+ exit 1
+ fi
+ ;;
+
+ 'reload'|'force-reload')
+ if test -s "$mariadbd_pid_file_path" ; then
+ read mariadbd_pid < "$mariadbd_pid_file_path"
+ su_kill -HUP $mariadbd_pid && log_success_msg "Reloading service MariaDB"
+ touch "$mariadbd_pid_file_path"
+ else
+ log_failure_msg "MariaDB PID file could not be found!"
+ exit 1
+ fi
+ ;;
+ 'status')
+ # First, check to see if pid file exists
+ if test -s "$mariadbd_pid_file_path" ; then
+ read mariadbd_pid < "$mariadbd_pid_file_path"
+ if su_kill -0 $mariadbd_pid ; then
+ log_success_msg "MariaDB running ($mariadbd_pid)"
+ exit 0
+ else
+ log_failure_msg "MariaDB is not running, but PID file exists"
+ exit 1
+ fi
+ else
+ # Try to find appropriate mariadbd process
+ mariadbd_pid=`pgrep -f $libexecdir/mariadbd`
+
+ # test if multiple pids exist
+ pid_count=`echo $mariadbd_pid | wc -w`
+ if test $pid_count -gt 1 ; then
+ log_failure_msg "Multiple MariaDB running but PID file could not be found ($mariadbd_pid)"
+ exit 5
+ elif test -z $mariadbd_pid ; then
+ if test -f "$lock_file_path" ; then
+ log_failure_msg "MariaDB is not running, but lock file ($lock_file_path) exists"
+ exit 2
+ fi
+ log_failure_msg "MariaDB is not running"
+ exit 3
+ else
+ log_failure_msg "MariaDB is running but PID file could not be found"
+ exit 4
+ fi
+ fi
+ ;;
+ 'configtest')
+ # Safeguard (relative paths, core dumps..)
+ cd $basedir
+ echo $echo_n "Testing MariaDB configuration syntax"
+ daemon=$bindir/mariadbd
+ if test -x $libexecdir/mariadbd
+ then
+ daemon=$libexecdir/mariadbd
+ elif test -x $sbindir/mariadbd
+ then
+ daemon=$sbindir/mariadbd
+ elif test -x `which mariadbd`
+ then
+ daemon=`which mariadbd`
+ else
+ log_failure_msg "Unable to locate the mariadbd binary!"
+ exit 1
+ fi
+ help_out=`$daemon --help 2>&1`; r=$?
+ if test "$r" != 0 ; then
+ log_failure_msg "$help_out"
+ log_failure_msg "There are syntax errors in the server configuration. Please fix them!"
+ else
+ log_success_msg "Syntax OK"
+ fi
+ exit $r
+ ;;
+ 'bootstrap')
+ if test "$_use_systemctl" == 1 ; then
+ log_failure_msg "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster"
+ exit 1
+ fi
+ # Bootstrap the cluster, start the first node
+ # that initiate the cluster
+ echo $echo_n "Bootstrapping the cluster.. "
+ $0 start $other_args --wsrep-new-cluster
+ exit $?
+ ;;
+ *)
+ # usage
+ basename=`basename "$0"`
+ echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MariaDB server options ]"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/support-files/mysqld_multi.server.sh b/support-files/mysqld_multi.server.sh
new file mode 100644
index 00000000..f00c6a56
--- /dev/null
+++ b/support-files/mysqld_multi.server.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# A simple startup script for mysqld_multi by Tim Smith and Jani Tolonen.
+# This script assumes that my.cnf file exists either in /etc/my.cnf or
+# /root/.my.cnf and has groups [mysqld_multi] and [mysqldN]. See the
+# mysqld_multi documentation for detailed instructions.
+#
+# This script can be used as /etc/init.d/mysql.server
+#
+# Comments to support chkconfig on RedHat Linux
+# chkconfig: 2345 64 36
+# description: A very fast and reliable SQL database engine.
+#
+# Version 1.0
+#
+
+### BEGIN INIT INFO
+# Provides: mysqld_multi
+# Required-Start: $local_fs $network $remote_fs
+# Should-Start: ypbind nscd ldap ntpd xntpd
+# Required-Stop: $local_fs $network $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop multiple mysql database server daemon instances
+# Description: Controls multiple MariaDB database server daemon instances
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=mysqld_multi
+DESC=mysqld_multi
+
+basedir=/usr
+bindir=/usr/bin
+
+if test -x $bindir/mysqld_multi
+then
+ mysqld_multi="$bindir/mysqld_multi";
+else
+ echo "Can't execute $bindir/mysqld_multi from dir $basedir";
+ exit;
+fi
+
+case "$1" in
+ 'start' )
+ "$mysqld_multi" start $2
+ ;;
+ 'stop' )
+ "$mysqld_multi" stop $2
+ ;;
+ 'report' )
+ "$mysqld_multi" report $2
+ ;;
+ 'restart' )
+ "$mysqld_multi" stop $2
+ "$mysqld_multi" start $2
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|report|restart}" >&2
+ ;;
+esac
diff --git a/support-files/policy/apparmor/README b/support-files/policy/apparmor/README
new file mode 100644
index 00000000..271655f1
--- /dev/null
+++ b/support-files/policy/apparmor/README
@@ -0,0 +1,5 @@
+Note: The included AppArmor profiles can be used for MariaDB Galera cluster.
+However, since these profiles had been tested for a limited set of scenarios,
+it is highly recommended to run them in "complain" mode and report any denials
+on mariadb.org/jira.
+
diff --git a/support-files/policy/apparmor/usr.sbin.mysqld b/support-files/policy/apparmor/usr.sbin.mysqld
new file mode 100644
index 00000000..c60ecd28
--- /dev/null
+++ b/support-files/policy/apparmor/usr.sbin.mysqld
@@ -0,0 +1,151 @@
+# Last Modified: Fri Mar 1 18:55:47 2013
+# Based on usr.sbin.mysqld packaged in mysql-server in Ubuntu.
+# This AppArmor profile has been copied under BSD License from
+# Percona XtraDB Cluster, along with some additions.
+
+#include <tunables/global>
+
+/usr/sbin/mariadbd flags=(complain) {
+ #include <abstractions/base>
+ #include <abstractions/mysql>
+ #include <abstractions/nameservice>
+ #include <abstractions/user-tmp>
+ #include <abstractions/winbind>
+
+ capability chown,
+ capability dac_override,
+ capability setgid,
+ capability setuid,
+ capability sys_rawio,
+ capability sys_resource,
+
+ network tcp,
+
+ /bin/dash rcx,
+ /dev/dm-0 r,
+ /etc/gai.conf r,
+ /etc/group r,
+ /etc/hosts.allow r,
+ /etc/hosts.deny r,
+ /etc/ld.so.cache r,
+ /etc/mtab r,
+ /etc/my.cnf r,
+ /etc/mysql/*.cnf r,
+ /etc/mysql/*.pem r,
+ /etc/mysql/conf.d/ r,
+ /etc/mysql/conf.d/* r,
+ /etc/mysql/mariadb.conf.d/ r,
+ /etc/mysql/mariadb.conf.d/* r,
+ /etc/nsswitch.conf r,
+ /etc/passwd r,
+ /etc/services r,
+ /run/mysqld/mysqld.pid w,
+ /run/mysqld/mysqld.sock w,
+ /sys/devices/system/cpu/ r,
+ owner /tmp/** lk,
+ /tmp/** rw,
+ /usr/lib/mysql/plugin/ r,
+ /usr/lib/mysql/plugin/*.so* mr,
+ /usr/sbin/mariadbd mr,
+ /usr/share/mysql/** r,
+ /var/lib/mysql/ r,
+ /var/lib/mysql/** rwk,
+ /var/log/mysql.err rw,
+ /var/log/mysql.log rw,
+ /var/log/mysql/ r,
+ /var/log/mysql/* rw,
+ /run/mysqld/mysqld.pid w,
+ /run/mysqld/mysqld.sock w,
+
+
+ profile /bin/dash flags=(complain) {
+ #include <abstractions/base>
+ #include <abstractions/bash>
+ #include <abstractions/mysql>
+ #include <abstractions/nameservice>
+ #include <abstractions/perl>
+
+
+
+ /bin/cat rix,
+ /bin/dash rix,
+ /bin/date rix,
+ /bin/grep rix,
+ /bin/nc.openbsd rix,
+ /bin/netstat rix,
+ /bin/ps rix,
+ /bin/rm rix,
+ /bin/sed rix,
+ /bin/sleep rix,
+ /bin/tar rix,
+ /bin/which rix,
+ /dev/tty rw,
+ /etc/ld.so.cache r,
+ /etc/my.cnf r,
+ /proc/ r,
+ /proc/*/cmdline r,
+ /proc/*/fd/ r,
+ /proc/*/net/dev r,
+ /proc/*/net/if_inet6 r,
+ /proc/*/net/tcp r,
+ /proc/*/net/tcp6 r,
+ /proc/*/stat r,
+ /proc/*/status r,
+ /proc/sys/kernel/pid_max r,
+ /proc/tty/drivers r,
+ /proc/uptime r,
+ /proc/version r,
+ /sbin/ifconfig rix,
+ /sys/devices/system/cpu/ r,
+ /tmp/** rw,
+ /usr/bin/cut rix,
+ /usr/bin/dirname rix,
+ /usr/bin/gawk rix,
+ /usr/bin/mysql rix,
+ /usr/bin/perl rix,
+ /usr/bin/seq rix,
+ /usr/bin/wsrep_sst* rix,
+ /usr/bin/wsrep_sst_common r,
+ /usr/bin/mariabackup* rix,
+ /var/lib/mysql/ r,
+ /var/lib/mysql/** rw,
+ /var/lib/mysql/*.log w,
+ /var/lib/mysql/*.err w,
+
+# MariaDB additions
+ ptrace peer=@{profile_name},
+
+ /bin/hostname rix,
+ /bin/ip rix,
+ /bin/mktemp rix,
+ /bin/ss rix,
+ /bin/sync rix,
+ /bin/touch rix,
+ /bin/uname rix,
+ /etc/mysql/*.cnf r,
+ /etc/mysql/conf.d/ r,
+ /etc/mysql/conf.d/* r,
+ /proc/*/attr/current r,
+ /proc/*/fdinfo/* r,
+ /proc/*/net/* r,
+ /proc/locks r,
+ /proc/sys/net/ipv4/ip_local_port_range r,
+ /run/mysqld/mysqld.sock rw,
+ /sbin/ip rix,
+ /usr/bin/basename rix,
+ /usr/bin/du rix,
+ /usr/bin/find rix,
+ /usr/bin/lsof rix,
+ /usr/bin/my_print_defaults rix,
+ /usr/bin/mysqldump rix,
+ /usr/bin/pv rix,
+ /usr/bin/rsync rix,
+ /usr/bin/socat rix,
+ /usr/bin/tail rix,
+ /usr/bin/timeout rix,
+ /usr/bin/xargs rix,
+ /usr/bin/xbstream rix,
+ }
+ # Site-specific additions and overrides. See local/README for details.
+ #include <local/usr.sbin.mariadbd>
+}
diff --git a/support-files/policy/apparmor/usr.sbin.mysqld.local b/support-files/policy/apparmor/usr.sbin.mysqld.local
new file mode 100644
index 00000000..a0b8a027
--- /dev/null
+++ b/support-files/policy/apparmor/usr.sbin.mysqld.local
@@ -0,0 +1,4 @@
+# Site-specific additions and overrides for usr.sbin.mysqld..
+# For more details, please see /etc/apparmor.d/local/README.
+# This AppArmor profile has been copied under BSD License from
+# Percona XtraDB Cluster, along with some additions.
diff --git a/support-files/policy/selinux/README b/support-files/policy/selinux/README
new file mode 100644
index 00000000..3f695dc2
--- /dev/null
+++ b/support-files/policy/selinux/README
@@ -0,0 +1,20 @@
+Note: The included SELinux policy files can be used for MariaDB Galera cluster.
+However, since these policies had been tested for a limited set of scenarios,
+it is highly recommended that you run mysqld in "permissive" mode even with
+these policies installed and report any denials on mariadb.org/jira.
+
+
+How to generate and load the policy module of MariaDB Galera cluster ?
+ * Generate the SELinux policy module.
+ # cd <source>/policy/selinux/
+ # make -f /usr/share/selinux/devel/Makefile mariadb-server.pp
+
+ * Load the generated policy module.
+ # semodule -i /path/to/mariadb-server.pp
+
+ * Lastly, run the following command to allow tcp/4568 and udp/4567.
+ # semanage port -a -t mysqld_port_t -p tcp 4568
+ # semanage port -a -t mysqld_port_t -p udp 4567
+
+How to run mysqld in permissve mode ?
+ # semanage permissive -a mysqld_t
diff --git a/support-files/policy/selinux/mariadb-server.fc b/support-files/policy/selinux/mariadb-server.fc
new file mode 100644
index 00000000..e3f2b501
--- /dev/null
+++ b/support-files/policy/selinux/mariadb-server.fc
@@ -0,0 +1,10 @@
+# This SELinux file contexts (.fc) file has been copied under New BSD License from
+# Percona XtraDB Cluster.
+
+/etc/init\.d/rc\.d/mysql -- gen_context(system_u:object_r:mysqld_initrc_exec_t,s0)
+/var/lib/mysql/.*\.log -- gen_context(system_u:object_r:mysqld_log_t,s0)
+/var/lib/mysql/.*\.err -- gen_context(system_u:object_r:mysqld_log_t,s0)
+/var/lib/mysql/.*\.pid -- gen_context(system_u:object_r:mysqld_var_run_t,s0)
+/var/lib/mysql/.*\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0)
+/usr/bin/mariabackup.* -- gen_context(system_u:object_r:mysqld_exec_t,s0)
+/usr/bin/wsrep.* -- gen_context(system_u:object_r:mysqld_safe_exec_t,s0)
diff --git a/support-files/policy/selinux/mariadb-server.te b/support-files/policy/selinux/mariadb-server.te
new file mode 100644
index 00000000..71924012
--- /dev/null
+++ b/support-files/policy/selinux/mariadb-server.te
@@ -0,0 +1,99 @@
+# This SELinux type enforcement (.te) file has been copied under New BSD License
+# from Percona XtraDB Cluster, along with some additions.
+
+module mariadb-server 1.0;
+
+require {
+ type user_tmp_t;
+ #type kerberos_master_port_t;
+ type mysqld_safe_t;
+ type tmp_t;
+ type tmpfs_t;
+ type hostname_exec_t;
+ type ifconfig_exec_t;
+ type sysctl_net_t;
+ type proc_net_t;
+ type port_t;
+ type mysqld_t;
+ type var_lib_t;
+ type rsync_exec_t;
+ type bin_t;
+ type shell_exec_t;
+ type anon_inodefs_t;
+ type fixed_disk_device_t;
+ class lnk_file read;
+ class process { getattr signull };
+ class unix_stream_socket connectto;
+ class capability { sys_resource sys_nice };
+ class tcp_socket { name_bind name_connect };
+ class file { execute setattr read create getattr execute_no_trans write ioctl open append unlink };
+ class sock_file { create unlink getattr };
+ class blk_file { read write open };
+ class dir { write search getattr add_name read remove_name open };
+
+# MariaDB additions
+ type kerberos_port_t;
+ type tram_port_t;
+ type mysqld_port_t;
+ class udp_socket name_bind;
+ class process setpgid;
+ class netlink_tcpdiag_socket { create nlmsg_read };
+}
+
+
+#============= mysqld_safe_t ==============
+allow mysqld_safe_t mysqld_t:process signull;
+allow mysqld_safe_t self:capability { sys_resource sys_nice };
+allow mysqld_safe_t tmp_t:file { create read write open getattr unlink ioctl setattr };
+allow mysqld_safe_t tmp_t:dir { write remove_name add_name };
+allow mysqld_safe_t tmp_t:sock_file { getattr unlink };
+allow mysqld_safe_t user_tmp_t:sock_file { getattr unlink };
+allow mysqld_safe_t var_lib_t:dir { write add_name };
+allow mysqld_safe_t var_lib_t:file { write ioctl setattr create open getattr append unlink };
+
+#============= mysqld_t ==============
+allow mysqld_t anon_inodefs_t:file write;
+allow mysqld_t tmp_t:sock_file { create unlink };
+allow mysqld_t tmpfs_t:dir { write search read remove_name open add_name };
+allow mysqld_t tmpfs_t:file { write getattr read create unlink open };
+allow mysqld_t fixed_disk_device_t:blk_file { read write open };
+allow mysqld_t ifconfig_exec_t:file { read execute open execute_no_trans getattr };
+
+#This rule allows connecting on 4444/4567/4568
+#allow mysqld_t kerberos_master_port_t:tcp_socket { name_bind name_connect };
+
+allow mysqld_t mysqld_safe_t:dir { getattr search };
+allow mysqld_t mysqld_safe_t:file { read open };
+allow mysqld_t self:unix_stream_socket connectto;
+allow mysqld_t port_t:tcp_socket { name_bind name_connect };
+allow mysqld_t proc_net_t:file { read getattr open };
+allow mysqld_t sysctl_net_t:dir search;
+allow mysqld_t var_lib_t:file { getattr open append };
+allow mysqld_t var_lib_t:sock_file { create unlink getattr };
+allow mysqld_t rsync_exec_t:file { read getattr open execute execute_no_trans };
+allow mysqld_t self:process getattr;
+allow mysqld_t hostname_exec_t:file { read getattr execute open execute_no_trans };
+allow mysqld_t user_tmp_t:dir { write add_name };
+allow mysqld_t user_tmp_t:file create;
+allow mysqld_t bin_t:lnk_file read;
+allow mysqld_t tmp_t:file { append create read write open getattr unlink setattr };
+
+# Allows too much leeway - the mariabackup/wsrep rules in fc should fix it, but
+# keep for the moment.
+allow mysqld_t shell_exec_t:file { execute_no_trans getattr read execute open };
+allow mysqld_t bin_t:file { getattr read execute open execute_no_trans ioctl };
+
+# MariaDB additions
+allow mysqld_t self:process setpgid;
+# This rule allows port tcp/4444
+allow mysqld_t kerberos_port_t:tcp_socket { name_bind name_connect };
+# This rule allows port tcp/4567 (tram_port_t may not be available on
+# older versions)
+allow mysqld_t tram_port_t:tcp_socket name_bind;
+# This rule allows port udp/4567 (see README)
+allow mysqld_t mysqld_port_t:udp_socket name_bind;
+
+# Rules related to mariabackup
+allow mysqld_t self:netlink_tcpdiag_socket { create nlmsg_read };
+allow mysqld_t sysctl_net_t:file { read getattr open };
+
diff --git a/support-files/policy/selinux/mariadb.te b/support-files/policy/selinux/mariadb.te
new file mode 100644
index 00000000..1d3de52c
--- /dev/null
+++ b/support-files/policy/selinux/mariadb.te
@@ -0,0 +1,9 @@
+module mariadb 1.0;
+
+require {
+ type mysqld_safe_t;
+ class capability { setuid setgid };
+}
+
+#============= mysqld_safe_t ==============
+allow mysqld_safe_t self:capability { setuid setgid };
diff --git a/support-files/rpm/client.cnf b/support-files/rpm/client.cnf
new file mode 100644
index 00000000..9028505a
--- /dev/null
+++ b/support-files/rpm/client.cnf
@@ -0,0 +1,13 @@
+#
+# These two groups are read by the client library
+# Use it for options that affect all clients, but not the server
+#
+
+
+[client]
+
+# This group is not read by mysql client library,
+# If you use the same .cnf file for MySQL and MariaDB,
+# use it for MariaDB-only client options
+[client-mariadb]
+
diff --git a/support-files/rpm/enable_encryption.preset b/support-files/rpm/enable_encryption.preset
new file mode 100644
index 00000000..722db7e5
--- /dev/null
+++ b/support-files/rpm/enable_encryption.preset
@@ -0,0 +1,20 @@
+#
+# !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
diff --git a/support-files/rpm/my.cnf b/support-files/rpm/my.cnf
new file mode 100644
index 00000000..5cda317d
--- /dev/null
+++ b/support-files/rpm/my.cnf
@@ -0,0 +1,11 @@
+#
+# This group is read both by the client and the server
+# use it for options that affect everything
+#
+[client-server]
+
+#
+# include *.cnf from the config directory
+#
+!includedir /etc/my.cnf.d
+
diff --git a/support-files/rpm/mysql-clients.cnf b/support-files/rpm/mysql-clients.cnf
new file mode 100644
index 00000000..3df9b7b9
--- /dev/null
+++ b/support-files/rpm/mysql-clients.cnf
@@ -0,0 +1,23 @@
+#
+# 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]
+
diff --git a/support-files/rpm/plugin-postin.sh b/support-files/rpm/plugin-postin.sh
new file mode 100644
index 00000000..1844de1b
--- /dev/null
+++ b/support-files/rpm/plugin-postin.sh
@@ -0,0 +1,3 @@
+# request the server restart
+mkdir -p %{restart_flag_dir}
+echo > %{restart_flag}
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
new file mode 100644
index 00000000..61c417e3
--- /dev/null
+++ b/support-files/rpm/server-postin.sh
@@ -0,0 +1,87 @@
+if [ -f /usr/lib/systemd/system/mariadb.service -a -x /usr/bin/systemctl ]; then
+ systemd_conf=/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
+ if [ -x %{_bindir}/mariadb-service-convert -a ! -f "${systemd_conf}" ]; then
+ # Either fresh install or upgrade non-systemd -> systemd
+ mkdir -p /etc/systemd/system/mariadb.service.d
+ %{_bindir}/mariadb-service-convert > "${systemd_conf}"
+ # Make sure old possibly non-systemd instance is down
+ if [ $1 = 2 ]; then
+ SYSTEMCTL_SKIP_REDIRECT=1 %{_sysconfdir}/init.d/mysql stop >/dev/null 2>&1 || :
+ systemctl start mariadb >/dev/null 2>&1 || :
+ fi
+ systemctl enable mariadb.service >/dev/null 2>&1 || :
+ fi
+fi
+
+# Make MySQL start/shutdown automatically when the machine does it.
+if [ $1 = 1 ] ; then
+ if [ -x /usr/bin/systemctl ] ; then
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ /usr/bin/systemctl preset mariadb.service >/dev/null 2>&1 || :
+ elif [ -x /sbin/chkconfig ] ; then
+ /sbin/chkconfig --add mysql
+ fi
+
+ basedir=`%{_bindir}/my_print_defaults --mysqld|sed -ne 's/^--basedir=//p'|tail -1`
+ if [ -z "$basedir" ] ; then
+ basedir=%{mysqlbasedir}
+ fi
+
+ datadir=`%{_bindir}/my_print_defaults --mysqld|sed -ne 's/^--datadir=//p'|tail -1`
+ if [ -z "$datadir" ] ; then
+ datadir=%{mysqldatadir}
+ else
+ # datadir may be relative to a basedir!
+ if ! expr $datadir : / > /dev/null; then
+ datadir=$basedir/$datadir
+ fi
+ fi
+
+ # Create a MySQL user and group. Do not report any problems if it already
+ # exists.
+ groupadd -r %{mysqld_group} 2> /dev/null || true
+ useradd -M -r --home $datadir --shell /sbin/nologin --comment "MySQL server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true
+ # The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
+ usermod --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true
+
+ # Temporary Workaround for MDEV-11386 - will be corrected in Advance Toolchain 10.0-3 and 8.0-8
+ for ldconfig in /opt/at*/sbin/ldconfig; do
+ test -x $ldconfig && $ldconfig
+ done
+
+ # Change permissions so that the user that will run the MySQL daemon
+ # owns all database files.
+ chown -R -f %{mysqld_user}:%{mysqld_group} $datadir
+
+ if [ ! -e $datadir/mysql ]; then
+ # Create data directory
+ mkdir -p $datadir
+
+ # Initiate databases
+ %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
+ fi
+
+ # Change permissions again to fix any new files.
+ chown -R %{mysqld_user}:%{mysqld_group} $datadir
+
+ # Fix permissions for the permission database so that only the user
+ # can read them.
+ chmod -R og-rw $datadir/mysql
+fi
+
+# Set the correct filesystem ownership for the PAM v2 plugin
+chown %{mysqld_user} /usr/lib*/mysql/plugin/auth_pam_tool_dir
+
+# install SELinux files - but don't override existing ones
+SETARGETDIR=/etc/selinux/targeted/src/policy
+SEDOMPROG=$SETARGETDIR/domains/program
+SECONPROG=$SETARGETDIR/file_contexts/program
+
+if [ -x /usr/sbin/semodule ] ; then
+ /usr/sbin/semodule -i /usr/share/mysql/policy/selinux/mariadb.pp
+fi
+
+if [ -x /sbin/restorecon ] ; then
+ /sbin/restorecon -R /var/lib/mysql
+fi
+
diff --git a/support-files/rpm/server-posttrans.sh b/support-files/rpm/server-posttrans.sh
new file mode 100644
index 00000000..d91ff65e
--- /dev/null
+++ b/support-files/rpm/server-posttrans.sh
@@ -0,0 +1,15 @@
+if [ -r %{restart_flag} ] ; then
+ rm %{restart_flag}
+ # only restart the server if it was already running
+ if [ -x /usr/bin/systemctl ] ; then
+ /usr/bin/systemctl daemon-reload > /dev/null 2>&1
+ if /usr/bin/systemctl is-active mysql; then
+ /usr/bin/systemctl restart mysql > /dev/null 2>&1
+ else
+ /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
+ fi
+ # not a systemd-enabled environment, use SysV startup script
+ elif %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then
+ %{_sysconfdir}/init.d/mysql restart > /dev/null 2>&1
+ fi
+fi
diff --git a/support-files/rpm/server-postun.sh b/support-files/rpm/server-postun.sh
new file mode 100644
index 00000000..27e1125b
--- /dev/null
+++ b/support-files/rpm/server-postun.sh
@@ -0,0 +1,12 @@
+if [ $1 -ge 1 ]; then
+ # request the server restart
+ mkdir -p %{restart_flag_dir}
+ echo > %{restart_flag}
+fi
+
+if [ $1 = 0 ] ; then
+ if [ -x /usr/bin/systemctl ] ; then
+ /usr/bin/systemctl daemon-reload > /dev/null 2>&1
+ fi
+fi
+
diff --git a/support-files/rpm/server-prein.sh b/support-files/rpm/server-prein.sh
new file mode 100644
index 00000000..9f8d1229
--- /dev/null
+++ b/support-files/rpm/server-prein.sh
@@ -0,0 +1,67 @@
+# Check if we can safely upgrade. An upgrade is only safe if it's from one
+# of our RPMs in the same version family.
+
+installed=`rpm -q --whatprovides mysql-server 2> /dev/null`
+if [ $? -eq 0 -a -n "$installed" ]; then
+ installed=`echo "$installed"|sed -n 1p`
+ vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1 | sed 's/Monty Program AB/MariaDB Foundation/'`
+ version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1`
+ myvendor='%{mysql_vendor}'
+ myversion='%{mysqlversion}'
+
+ old_family=`echo $version | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'`
+ new_family=`echo $myversion | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'`
+
+ [ -z "$vendor" ] && vendor='<unknown>'
+ [ -z "$old_family" ] && old_family="<unrecognized version $version>"
+ [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>"
+
+ error_text=
+ if [ "$vendor" != "$myvendor" ]; then
+ error_text="$error_text
+The current MariaDB server package is provided by a different
+vendor ($vendor) than $myvendor. Some files may be installed
+to different locations, including log files and the service
+startup script in %{_sysconfdir}/init.d/.
+"
+ fi
+
+ if [ "$old_family" != "$new_family" ]; then
+ error_text="$error_text
+Upgrading directly from MySQL $old_family to MariaDB $new_family may not
+be safe in all cases. A manual dump and restore using mysqldump is
+recommended. It is important to review the MariaDB manual's Upgrading
+section for version-specific incompatibilities.
+"
+ fi
+
+ if [ -n "$error_text" ]; then
+ cat <<HERE >&2
+
+******************************************************************
+A MySQL or MariaDB server package ($installed) is installed.
+$error_text
+A manual upgrade is required.
+
+- Ensure that you have a complete, working backup of your data and my.cnf
+ files
+- Shut down the MySQL server cleanly
+- Remove the existing MySQL packages. Usually this command will
+ list the packages you should remove:
+ rpm -qa | grep -i '^mysql-'
+
+ You may choose to use 'rpm --nodeps -ev <package-name>' to remove
+ the package which contains the mysqlclient shared library. The
+ library will be reinstalled by the MariaDB-shared package.
+- Install the new MariaDB packages supplied by $myvendor
+- Ensure that the MariaDB server is started
+- Run the 'mysql_upgrade' program
+
+This is a brief description of the upgrade process. Important details
+can be found in the MariaDB manual, in the Upgrading section.
+******************************************************************
+HERE
+ exit 1
+ fi
+fi
+
diff --git a/support-files/rpm/server-preun.sh b/support-files/rpm/server-preun.sh
new file mode 100644
index 00000000..34a35cbc
--- /dev/null
+++ b/support-files/rpm/server-preun.sh
@@ -0,0 +1,18 @@
+if [ $1 = 0 ] ; then
+ # Stop MySQL before uninstalling it
+ # Don't start it automatically anymore
+ if [ -x /usr/bin/systemctl ] ; then
+ /usr/bin/systemctl stop mariadb.service > /dev/null 2>&1
+ /usr/bin/systemctl disable mariadb.service > /dev/null 2>&1
+ fi
+ if [ -x %{_sysconfdir}/init.d/mysql ] ; then
+ %{_sysconfdir}/init.d/mysql stop > /dev/null
+ if [ -x /sbin/chkconfig ] ; then
+ /sbin/chkconfig --del mysql > /dev/null 2>&1 || :
+ fi
+ fi
+fi
+
+# We do not remove the mysql user since it may still own a lot of
+# database files.
+
diff --git a/support-files/rpm/server.cnf b/support-files/rpm/server.cnf
new file mode 100644
index 00000000..c401ea98
--- /dev/null
+++ b/support-files/rpm/server.cnf
@@ -0,0 +1,46 @@
+#
+# 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.5 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.5]
+
diff --git a/support-files/rpm/shared-post.sh b/support-files/rpm/shared-post.sh
new file mode 100644
index 00000000..8b0c8224
--- /dev/null
+++ b/support-files/rpm/shared-post.sh
@@ -0,0 +1 @@
+/sbin/ldconfig
diff --git a/support-files/sysusers.conf.in b/support-files/sysusers.conf.in
new file mode 100644
index 00000000..a975b294
--- /dev/null
+++ b/support-files/sysusers.conf.in
@@ -0,0 +1 @@
+u @MYSQLD_USER@ - "MariaDB" @MYSQL_DATADIR@
diff --git a/support-files/tmpfiles.conf.in b/support-files/tmpfiles.conf.in
new file mode 100644
index 00000000..03d66abc
--- /dev/null
+++ b/support-files/tmpfiles.conf.in
@@ -0,0 +1 @@
+d @MYSQL_UNIX_DIR@ 0755 @MYSQLD_USER@ @MYSQLD_USER@ -
diff --git a/support-files/use_galera_new_cluster.conf b/support-files/use_galera_new_cluster.conf
new file mode 100644
index 00000000..79d19109
--- /dev/null
+++ b/support-files/use_galera_new_cluster.conf
@@ -0,0 +1,27 @@
+#
+# Install as /etc/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
+#
+# MariaDB uses /usr/bin/galera_new_cluster
+#
+# This is here to help guide people that may have used Percona mysql@bootstrap
+# to the correct implementation.
+
+[Unit]
+
+ConditionPathExists=
+
+[Service]
+
+Type=oneshot
+Restart=no
+
+# Don't install or try to prepare for galera SST.
+ExecStartPre=
+
+# Override the multi instance service for a bootstrap start instance
+ExecStart=
+ExecStart=/usr/bin/echo "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster"
+ExecStart=/usr/bin/false
+
+# This isn't a service meant to execute anything but a message
+ExecStartPost=
diff --git a/support-files/wsrep.cnf.sh b/support-files/wsrep.cnf.sh
new file mode 100644
index 00000000..7242fff9
--- /dev/null
+++ b/support-files/wsrep.cnf.sh
@@ -0,0 +1,125 @@
+# This file contains wsrep-related mysqld options. It should be included
+# in the main MySQL configuration file.
+#
+# Options that need to be customized:
+# - wsrep_provider
+# - wsrep_cluster_address
+# - wsrep_sst_auth
+# The rest of defaults should work out of the box.
+
+##
+## mysqld options _MANDATORY_ for correct opration of the cluster
+##
+[mysqld]
+
+# (This must be substituted by wsrep_format)
+binlog_format=ROW
+
+# Currently only InnoDB storage engine is supported
+default-storage-engine=innodb
+
+# to avoid issues with 'bulk mode inserts' using autoinc
+innodb_autoinc_lock_mode=2
+
+# Override bind-address
+# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST
+# it will have (most likely) disastrous consequences on donor node
+bind-address=0.0.0.0
+
+##
+## WSREP options
+##
+
+# Enable wsrep
+wsrep_on=1
+
+# Full path to wsrep provider library or 'none'
+wsrep_provider=none
+
+# Provider specific configuration options
+#wsrep_provider_options=
+
+# Logical cluster name. Should be the same for all nodes.
+wsrep_cluster_name="my_wsrep_cluster"
+
+# Group communication system handle
+#wsrep_cluster_address="dummy://"
+
+# Human-readable node name (non-unique). Hostname by default.
+#wsrep_node_name=
+
+# Base replication <address|hostname>[:port] of the node.
+# The values supplied will be used as defaults for state transfer receiving,
+# listening ports and so on. Default: address of the first network interface.
+#wsrep_node_address=
+
+# Address for incoming client connections. Autodetect by default.
+#wsrep_node_incoming_address=
+
+# How many threads will process writesets from other nodes
+wsrep_slave_threads=1
+
+# DBUG options for wsrep provider
+#wsrep_dbug_option
+
+# Generate fake primary keys for non-PK tables (required for multi-master
+# and parallel applying operation)
+wsrep_certify_nonPK=1
+
+# Maximum number of rows in write set
+wsrep_max_ws_rows=0
+
+# Maximum size of write set
+wsrep_max_ws_size=2147483647
+
+# to enable debug level logging, set this to 1
+wsrep_debug=0
+
+# convert locking sessions into transactions
+wsrep_convert_LOCK_to_trx=0
+
+# how many times to retry deadlocked autocommits
+wsrep_retry_autocommit=1
+
+# change auto_increment_increment and auto_increment_offset automatically
+wsrep_auto_increment_control=1
+
+# retry autoinc insert, which failed for duplicate key error
+wsrep_drupal_282555_workaround=0
+
+# enable "strictly synchronous" semantics for read operations
+wsrep_causal_reads=0
+
+# Command to call when node status or cluster membership changes.
+# Will be passed all or some of the following options:
+# --status - new status of this node
+# --uuid - UUID of the cluster
+# --primary - whether the component is primary or not ("yes"/"no")
+# --members - comma-separated list of members
+# --index - index of this node in the list
+wsrep_notify_cmd=
+
+##
+## WSREP State Transfer options
+##
+
+# State Snapshot Transfer method
+wsrep_sst_method=rsync
+
+# Address which donor should send State Snapshot to.
+# Should be the address of THIS node. DON'T SET IT TO DONOR ADDRESS!!!
+# (SST method dependent. Defaults to the first IP of the first interface)
+#wsrep_sst_receive_address=
+
+# SST authentication string. This will be used to send SST to joining nodes.
+# Depends on SST method. For mysqldump method it is root:<root password>
+wsrep_sst_auth=root:
+
+# Desired SST donor name.
+#wsrep_sst_donor=
+
+# Reject client queries when donating SST (false)
+#wsrep_sst_donor_rejects_queries=0
+
+# Protocol version to use
+# wsrep_protocol_version=
diff --git a/support-files/wsrep_notify.sh b/support-files/wsrep_notify.sh
new file mode 100644
index 00000000..bdbe3d12
--- /dev/null
+++ b/support-files/wsrep_notify.sh
@@ -0,0 +1,102 @@
+#!/bin/sh -eu
+
+# This is a simple example of wsrep notification script (wsrep_notify_cmd).
+# It will create 'wsrep' schema and two tables in it: 'membeship' and 'status'
+# and fill them on every membership or node status change.
+#
+# Edit parameters below to specify the address and login to server.
+
+USER=root
+PSWD=rootpass
+HOST=127.0.0.1
+PORT=3306
+
+SCHEMA="wsrep"
+MEMB_TABLE="$SCHEMA.membership"
+STATUS_TABLE="$SCHEMA.status"
+
+BEGIN="
+SET wsrep_on=0;
+DROP SCHEMA IF EXISTS $SCHEMA; CREATE SCHEMA $SCHEMA;
+CREATE TABLE $MEMB_TABLE (
+ idx INT UNIQUE PRIMARY KEY,
+ uuid CHAR(40) UNIQUE, /* node UUID */
+ name VARCHAR(32), /* node name */
+ addr VARCHAR(256) /* node address */
+) ENGINE=MEMORY;
+CREATE TABLE $STATUS_TABLE (
+ size INT, /* component size */
+ idx INT, /* this node index */
+ status CHAR(16), /* this node status */
+ uuid CHAR(40), /* cluster UUID */
+ prim BOOLEAN /* if component is primary */
+) ENGINE=MEMORY;
+BEGIN;
+DELETE FROM $MEMB_TABLE;
+DELETE FROM $STATUS_TABLE;
+"
+END="COMMIT;"
+
+configuration_change()
+{
+ echo "$BEGIN;"
+
+ local idx=0
+
+ for NODE in $(echo $MEMBERS | sed s/,/\ /g)
+ do
+ echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, "
+ # Don't forget to properly quote string values
+ echo "'$NODE'" | sed s/\\//\',\'/g
+ echo ");"
+ idx=$(( $idx + 1 ))
+ done
+
+ echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
+
+ echo "$END"
+}
+
+status_update()
+{
+ echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;"
+}
+
+COM=status_update # not a configuration change by default
+
+while [ $# -gt 0 ]
+do
+ case $1 in
+ --status)
+ STATUS=$2
+ shift
+ ;;
+ --uuid)
+ CLUSTER_UUID=$2
+ shift
+ ;;
+ --primary)
+ [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0"
+ COM=configuration_change
+ shift
+ ;;
+ --index)
+ INDEX=$2
+ shift
+ ;;
+ --members)
+ MEMBERS=$2
+ shift
+ ;;
+ esac
+ shift
+done
+
+# Undefined means node is shutting down
+if [ "$STATUS" != "Undefined" ]
+then
+ $COM | mysql -B -u$USER -p$PSWD -h$HOST -P$PORT
+fi
+
+exit 0
+#