From bfeeb8ad08433b4da25106914f8cb1f1810bedf5 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 20 Aug 2013 21:51:01 +0000 Subject: [PATCH 1/1] - from PLD --- bison3.patch | 40 ++ bug-67402.patch | 14 + libmysql.version | 152 +++++ my.cnf | 2 + mysql-bug-43594.patch | 30 + mysql-build.patch | 12 + mysql-chain-certs.patch | 41 ++ mysql-client.conf | 8 + mysql-clusters.conf | 10 + mysql-config.patch | 30 + mysql-dubious-exports.patch | 59 ++ mysql-link.patch | 45 ++ mysql-ndb-cpc.init | 92 +++ mysql-ndb-cpc.sysconfig | 2 + mysql-ndb-mgm.init | 92 +++ mysql-ndb-mgm.sysconfig | 2 + mysql-ndb.init | 92 +++ mysql-ndb.sysconfig | 2 + mysql-sphinx.patch | 33 + mysql-system-users.patch | 34 ++ mysql-upgrade.patch | 36 ++ mysql.init | 730 ++++++++++++++++++++++ mysql.logrotate | 34 ++ mysql.spec | 1140 +++++++++++++++++++++++++++++++++++ mysql.sysconfig | 27 + mysqld.conf | 229 +++++++ mysqlhotcopy-5.0-5.5.patch | 11 + 27 files changed, 2999 insertions(+) create mode 100644 bison3.patch create mode 100644 bug-67402.patch create mode 100644 libmysql.version create mode 100644 my.cnf create mode 100644 mysql-bug-43594.patch create mode 100644 mysql-build.patch create mode 100644 mysql-chain-certs.patch create mode 100644 mysql-client.conf create mode 100644 mysql-clusters.conf create mode 100644 mysql-config.patch create mode 100644 mysql-dubious-exports.patch create mode 100644 mysql-link.patch create mode 100755 mysql-ndb-cpc.init create mode 100644 mysql-ndb-cpc.sysconfig create mode 100755 mysql-ndb-mgm.init create mode 100644 mysql-ndb-mgm.sysconfig create mode 100755 mysql-ndb.init create mode 100644 mysql-ndb.sysconfig create mode 100644 mysql-sphinx.patch create mode 100644 mysql-system-users.patch create mode 100644 mysql-upgrade.patch create mode 100755 mysql.init create mode 100644 mysql.logrotate create mode 100644 mysql.spec create mode 100644 mysql.sysconfig create mode 100644 mysqld.conf create mode 100644 mysqlhotcopy-5.0-5.5.patch diff --git a/bison3.patch b/bison3.patch new file mode 100644 index 0000000..d8e0985 --- /dev/null +++ b/bison3.patch @@ -0,0 +1,40 @@ +--- Percona-Server-5.5.32-rel31.0/sql/sql_yacc.yy.orig 2013-07-01 05:16:34.000000000 +0200 ++++ Percona-Server-5.5.32-rel31.0/sql/sql_yacc.yy 2013-08-18 21:33:19.181583895 +0200 +@@ -26,8 +26,6 @@ + ** The type will be void*, so it must be cast to (THD*) when used. + ** Use the YYTHD macro for this. + */ +-#define YYPARSE_PARAM yythd +-#define YYLEX_PARAM yythd + #define YYTHD ((THD *)yythd) + #define YYLIP (& YYTHD->m_parser_state->m_lip) + #define YYPS (& YYTHD->m_parser_state->m_yacc) +@@ -76,7 +74,7 @@ + ulong val= *(F); \ + if (my_yyoverflow((B), (D), &val)) \ + { \ +- yyerror((char*) (A)); \ ++ yyerror(yythd, (char*) (A)); \ + return 2; \ + } \ + else \ +@@ -174,7 +172,7 @@ + to abort from the parser. + */ + +-void MYSQLerror(const char *s) ++void MYSQLerror(void *yythd, const char *s) + { + THD *thd= current_thd; + +@@ -780,7 +778,9 @@ + bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); + %} + +-%pure_parser /* We have threads */ ++%pure-parser /* We have threads */ ++%parse-param { void *yythd } ++%lex-param { void *yythd } + /* + Currently there are 168 shift/reduce conflicts. + We should not introduce new conflicts any more. diff --git a/bug-67402.patch b/bug-67402.patch new file mode 100644 index 0000000..18bd2ee --- /dev/null +++ b/bug-67402.patch @@ -0,0 +1,14 @@ + +Upstream-Bugtracker: http://bugs.mysql.com/67402 + +--- 5.5.27/scripts/mysqlhotcopy.sh~ 2012-10-28 21:20:46.000000000 +0200 ++++ 5.5.27/scripts/mysqlhotcopy.sh 2012-10-28 21:23:12.574442093 +0200 +@@ -895,7 +895,7 @@ + + CREATE TABLE log_pos ( + host varchar(60) NOT null, +- time_stamp timestamp(14) NOT NULL, ++ time_stamp timestamp NOT NULL, + log_file varchar(32) default NULL, + log_pos int(11) default NULL, + master_host varchar(60) NULL, diff --git a/libmysql.version b/libmysql.version new file mode 100644 index 0000000..3b45f43 --- /dev/null +++ b/libmysql.version @@ -0,0 +1,152 @@ +# symbols exported from mysql 5.1 +libmysqlclient_16 { + global: + _fini; + _init; + my_init; + myodbc_remove_escape; + mysql_affected_rows; + mysql_autocommit; + mysql_change_user; + mysql_character_set_name; + mysql_close; + mysql_commit; + mysql_data_seek; + mysql_debug; + mysql_dump_debug_info; + mysql_embedded; + mysql_eof; + mysql_errno; + mysql_error; + mysql_escape_string; + mysql_fetch_field; + mysql_fetch_field_direct; + mysql_fetch_fields; + mysql_fetch_lengths; + mysql_fetch_row; + mysql_field_count; + mysql_field_seek; + mysql_field_tell; + mysql_free_result; + mysql_get_character_set_info; + mysql_get_client_info; + mysql_get_client_version; + mysql_get_host_info; + mysql_get_parameters; + mysql_get_proto_info; + mysql_get_server_info; + mysql_get_server_version; + mysql_get_ssl_cipher; + mysql_hex_string; + mysql_info; + mysql_init; + mysql_insert_id; + mysql_kill; + mysql_list_dbs; + mysql_list_fields; + mysql_list_processes; + mysql_list_tables; + mysql_more_results; + mysql_next_result; + mysql_num_fields; + mysql_num_rows; + mysql_options; + mysql_ping; + mysql_query; + mysql_read_query_result; + mysql_real_connect; + mysql_real_escape_string; + mysql_real_query; + mysql_refresh; + mysql_rollback; + mysql_row_seek; + mysql_row_tell; + mysql_select_db; + mysql_send_query; + mysql_server_end; + mysql_server_init; + mysql_set_character_set; + mysql_set_local_infile_default; + mysql_set_local_infile_handler; + mysql_set_server_option; + mysql_shutdown; + mysql_sqlstate; + mysql_ssl_set; + mysql_stat; + mysql_stmt_affected_rows; + mysql_stmt_attr_get; + mysql_stmt_attr_set; + mysql_stmt_bind_param; + mysql_stmt_bind_result; + mysql_stmt_close; + mysql_stmt_data_seek; + mysql_stmt_errno; + mysql_stmt_error; + mysql_stmt_execute; + mysql_stmt_fetch; + mysql_stmt_fetch_column; + mysql_stmt_field_count; + mysql_stmt_free_result; + mysql_stmt_init; + mysql_stmt_insert_id; + mysql_stmt_num_rows; + mysql_stmt_param_count; + mysql_stmt_param_metadata; + mysql_stmt_prepare; + mysql_stmt_reset; + mysql_stmt_result_metadata; + mysql_stmt_row_seek; + mysql_stmt_row_tell; + mysql_stmt_send_long_data; + mysql_stmt_sqlstate; + mysql_stmt_store_result; + mysql_store_result; + mysql_thread_end; + mysql_thread_id; + mysql_thread_init; + mysql_thread_safe; + mysql_use_result; + mysql_warning_count; +# These are documented in Paul DuBois' MySQL book, so we treat them as part +# of the de-facto API. + free_defaults; + handle_options; + load_defaults; + my_print_help; + client_errors; +# This isn't really documented anywhere, but it seems to be part of the +# de-facto API as well. We're not going to export the deprecated version +# make_scrambled_password, however. + my_make_scrambled_password; + local: + *; +}; +# symbols added in mysql 5.5 +libmysqlclient_18 { + global: + mysql_client_find_plugin; + mysql_client_register_plugin; + mysql_load_plugin; + mysql_load_plugin_v; + mysql_plugin_options; + mysql_stmt_next_result; +# +# Ideally the following symbols wouldn't be exported, but various applications +# require them. We limit the namespace damage by prefixing mysql_ +# (see mysql-dubious-exports.patch), which means the symbols are not present +# in libmysqlclient_16. +# +# mysql-connector-odbc requires these + mysql_default_charset_info; + mysql_get_charset; + mysql_get_charset_by_csname; + mysql_net_realloc; +# PHP's mysqli.so requires this (via the ER() macro) + mysql_client_errors; +# perl-DBD-mysql-4.018 for is_prefix + mysql_is_prefix; +# hiphop-php: TODO: added mysql_ prefix + cli_safe_read; + net_field_length; + free_root; +}; diff --git a/my.cnf b/my.cnf new file mode 100644 index 0000000..c84a6cf --- /dev/null +++ b/my.cnf @@ -0,0 +1,2 @@ +[client] +user=mysql diff --git a/mysql-bug-43594.patch b/mysql-bug-43594.patch new file mode 100644 index 0000000..b8cc07b --- /dev/null +++ b/mysql-bug-43594.patch @@ -0,0 +1,30 @@ +=== modified file 'scripts/mysqlhotcopy.sh' +--- scripts/mysqlhotcopy.sh 2008-03-07 20:45:40 +0000 ++++ scripts/mysqlhotcopy.sh 2009-03-12 13:06:42 +0000 +@@ -777,7 +777,24 @@ sub get_list_of_tables { + } || []; + warn "Unable to retrieve list of tables in $db: $@" if $@; + +- return (map { $_->[0] } @$tables); ++ my @ignore_tables = (); ++ ++ # Ignore tables for the mysql database ++ if ($db eq 'mysql') { ++ @ignore_tables = qw(general_log slow_log schema apply_status); ++ } ++ ++ my @res = (); ++ if ($#ignore_tables > 1) { ++ my @tmp = (map { $_->[0] } @$tables); ++ for my $t (@tmp) { ++ push(@res, $t) if not exists { map { $_=>1 } @ignore_tables }->{$t}; ++ } ++ } else { ++ @res = (map { $_->[0] } @$tables); ++ } ++ ++ return @res; + } + + sub quote_names { + diff --git a/mysql-build.patch b/mysql-build.patch new file mode 100644 index 0000000..11ef6ee --- /dev/null +++ b/mysql-build.patch @@ -0,0 +1,12 @@ +diff -urNbB mysql-5.0.13-rc.org/sql/mysqld.cc mysql-5.0.13-rc/sql/mysqld.cc +--- mysql-5.0.13-rc.org/sql/mysqld.cc 2005-09-22 21:39:56.000000000 +0200 ++++ mysql-5.0.13-rc/sql/mysqld.cc 2005-09-29 19:29:59.991454000 +0200 +@@ -3183,7 +3183,7 @@ + init_ssl(); + + #ifdef HAVE_LIBWRAP +- libwrapName= my_progname+dirname_length(my_progname); ++ libwrapName= (char *)my_progname+dirname_length(my_progname); + openlog(libwrapName, LOG_PID, LOG_AUTH); + #endif + diff --git a/mysql-chain-certs.patch b/mysql-chain-certs.patch new file mode 100644 index 0000000..3914311 --- /dev/null +++ b/mysql-chain-certs.patch @@ -0,0 +1,41 @@ +Fix things so that chains of certificates work in the server and client +certificate files. + +This only really works for OpenSSL-based builds, as yassl is unable to read +multiple certificates from a file. The patch below to yassl/src/ssl.cpp +doesn't fix that, but just arranges that the viosslfactories.c patch won't +have any ill effects in a yassl build. Since we don't use yassl in Red Hat/ +Fedora builds, I'm not feeling motivated to try to fix yassl for this. + +See RH bug #598656. Filed upstream at http://bugs.mysql.com/bug.php?id=54158 + + +diff -Naur mysql-5.1.47.orig/vio/viosslfactories.c mysql-5.1.47/vio/viosslfactories.c +--- mysql-5.1.47.orig/vio/viosslfactories.c 2010-05-06 11:28:07.000000000 -0400 ++++ mysql-5.1.47/vio/viosslfactories.c 2010-05-26 23:23:46.000000000 -0400 +@@ -106,7 +106,7 @@ + key_file= cert_file; + + if (cert_file && +- SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) ++ SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) + { + *error= SSL_INITERR_CERT; + DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file)); +diff -Naur mysql-5.1.47.orig/extra/yassl/src/ssl.cpp mysql-5.1.47/extra/yassl/src/ssl.cpp +--- mysql-5.1.47.orig/extra/yassl/src/ssl.cpp 2010-05-06 11:24:26.000000000 -0400 ++++ mysql-5.1.47/extra/yassl/src/ssl.cpp 2010-05-26 23:29:13.000000000 -0400 +@@ -1606,10 +1606,10 @@ + } + + +- int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) ++ int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file) + { +- // TDOD: +- return SSL_SUCCESS; ++ // For the moment, treat like use_certificate_file ++ return read_file(ctx, file, SSL_FILETYPE_PEM, Cert); + } + + diff --git a/mysql-client.conf b/mysql-client.conf new file mode 100644 index 0000000..ee5d1e4 --- /dev/null +++ b/mysql-client.conf @@ -0,0 +1,8 @@ +[client] +#user=mysql +#default-character-set=utf8 +#default-character-set=latin2 + +[mysql] +prompt='\\R:\\m:\\s mysql{\\c}> ' +show-warnings diff --git a/mysql-clusters.conf b/mysql-clusters.conf new file mode 100644 index 0000000..c617647 --- /dev/null +++ b/mysql-clusters.conf @@ -0,0 +1,10 @@ +# This file contains MySQL clusters configuration. +# If you want to use more than one cluster read carefuly +# http://www.mysql.com/doc/en/Multiple_servers.html +# and set properly all described there options. +# +# You can add one cluster per line +# /config/location.conf=/cluster/directory +# If you give config name without path it defaults to /etc/mysql/ + +mysqld.conf=/var/lib/mysql diff --git a/mysql-config.patch b/mysql-config.patch new file mode 100644 index 0000000..7a8fc65 --- /dev/null +++ b/mysql-config.patch @@ -0,0 +1,30 @@ +--- mysql-5.1.26-rc/scripts/mysql_config.sh.orig 2008-07-01 00:36:15.000000000 +0200 ++++ mysql-5.1.26-rc/scripts/mysql_config.sh 2008-08-25 19:39:20.111236513 +0200 +@@ -132,21 +132,21 @@ + DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \ + 'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \ + Xa xstrconst "xc99=none" AC99 \ +- unroll2 ip mp restrict ++ unroll2 ip mp restrict 'f[-a-z0-9]*' 'g[-a-z0-9]*' 'm[-a-z0-9]*' + do + # The first option we might strip will always have a space before it because + # we set -I$pkgincludedir as the first option +- cflags=`echo "$cflags"|sed -e "s/ -$remove */ /g"` ++ cflags=`echo "$cflags"|sed -e "s/ \(-$remove *\)\{1,\}/ /g"` + done + cflags=`echo "$cflags"|sed -e 's/ *\$//'` + + # Same for --libs(_r) +-for remove in lmtmalloc static-libcxa i-static static-intel ++for remove in lmtmalloc static-libcxa i-static static-intel 'Wl,-[-a-z0-9,]*' + do + # We know the strings starts with a space +- libs=`echo "$libs"|sed -e "s/ -$remove */ /g"` +- libs_r=`echo "$libs_r"|sed -e "s/ -$remove */ /g"` +- embedded_libs=`echo "$embedded_libs"|sed -e "s/ -$remove */ /g"` ++ libs=`echo "$libs"|sed -e "s/ \(-$remove *\)\{1,\}/ /g"` ++ libs_r=`echo "$libs_r"|sed -e "s/ \(-$remove *\)\{1,\}/ /g"` ++ embedded_libs=`echo "$embedded_libs"|sed -e "s/ \(-$remove *\)\{1,\}/ /g"` + done + + # Strip trailing and ending space if any, and '+' (FIXME why?) diff --git a/mysql-dubious-exports.patch b/mysql-dubious-exports.patch new file mode 100644 index 0000000..8874fce --- /dev/null +++ b/mysql-dubious-exports.patch @@ -0,0 +1,59 @@ +Prefix mysql_ to the real names of several symbols that have to be exported +from libmysqlclient because mysql-connector-odbc and/or PHP depend on them. +This limits the intrusion on application namespace. + + +diff -Naur mysql-5.5.8.orig/include/my_sys.h mysql-5.5.8/include/my_sys.h +--- mysql-5.5.8.orig/include/my_sys.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/my_sys.h 2010-12-27 14:27:23.956926896 -0500 +@@ -227,6 +227,7 @@ + + /* charsets */ + #define MY_ALL_CHARSETS_SIZE 2048 ++#define default_charset_info mysql_default_charset_info /* namespace sanity */ + extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; + extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; + extern CHARSET_INFO compiled_charsets[]; +@@ -914,6 +915,9 @@ + extern uint get_collation_number(const char *name); + extern const char *get_charset_name(uint cs_number); + ++#define get_charset mysql_get_charset /* namespace sanity */ ++#define get_charset_by_csname mysql_get_charset_by_csname ++ + extern CHARSET_INFO *get_charset(uint cs_number, myf flags); + extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); + extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, +diff -Naur mysql-5.5.8.orig/include/mysql.h.pp mysql-5.5.8/include/mysql.h.pp +--- mysql-5.5.8.orig/include/mysql.h.pp 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/mysql.h.pp 2010-12-27 14:27:23.956926896 -0500 +@@ -86,7 +86,7 @@ + void my_net_local_init(NET *net); + void net_end(NET *net); + void net_clear(NET *net, my_bool clear_buffer); +-my_bool net_realloc(NET *net, size_t length); ++my_bool mysql_net_realloc(NET *net, size_t length); + my_bool net_flush(NET *net); + my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); + my_bool net_write_command(NET *net,unsigned char command, +diff -Naur mysql-5.5.8.orig/include/mysql_com.h mysql-5.5.8/include/mysql_com.h +--- mysql-5.5.8.orig/include/mysql_com.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/mysql_com.h 2010-12-27 14:27:23.957927198 -0500 +@@ -448,6 +448,7 @@ + void my_net_local_init(NET *net); + void net_end(NET *net); + void net_clear(NET *net, my_bool clear_buffer); ++#define net_realloc mysql_net_realloc /* namespace sanity */ + my_bool net_realloc(NET *net, size_t length); + my_bool net_flush(NET *net); + my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); +--- mysql-5.5.9/include/m_string.h~ 2011-01-20 00:37:08.000000000 +0200 ++++ mysql-5.5.9/include/m_string.h 2011-03-31 16:36:35.184588054 +0300 +@@ -118,6 +118,7 @@ + extern size_t strnlen(const char *s, size_t n); + #endif + ++#define is_prefix mysql_is_prefix /* namespace sanity */ + extern int is_prefix(const char *, const char *); + + /* Conversion routines */ diff --git a/mysql-link.patch b/mysql-link.patch new file mode 100644 index 0000000..ecdaaed --- /dev/null +++ b/mysql-link.patch @@ -0,0 +1,45 @@ +Workaround for: https://bugs.launchpad.net/percona-server/+bug/747152 + +When linking plugins which are linked to libraries already linked with +probes_mysql.o, skip adding (second) probes_mysql.o . + +--- Percona-Server-5.5.32-rel31.0/cmake/plugin.cmake.orig 2013-07-01 05:16:34.000000000 +0200 ++++ Percona-Server-5.5.32-rel31.0/cmake/plugin.cmake 2013-07-12 17:57:12.120001411 +0200 +@@ -47,7 +47,7 @@ + MACRO(MYSQL_ADD_PLUGIN) + MYSQL_PARSE_ARGUMENTS(ARG + "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME" +- "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED" ++ "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;SKIP_PROBES" + ${ARGN} + ) + +@@ -170,7 +170,9 @@ + + ADD_VERSION_INFO(${target} MODULE SOURCES) + ADD_LIBRARY(${target} MODULE ${SOURCES}) ++ IF(NOT ARG_SKIP_PROBES) + DTRACE_INSTRUMENT(${target}) ++ ENDIF() + SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "" + COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN") + TARGET_LINK_LIBRARIES (${target} mysqlservices) +--- Percona-Server-5.5.32-rel31.0/storage/sphinx/CMakeLists.txt.orig 2012-11-05 12:48:48.000000000 +0100 ++++ Percona-Server-5.5.32-rel31.0/storage/sphinx/CMakeLists.txt 2013-07-12 17:57:36.740000378 +0200 +@@ -12,5 +12,5 @@ + ADD_LIBRARY(sphinx ha_sphinx.cc snippets_udf.cc) + ELSE() + SET(SPHINX_PLUGIN_DYNAMIC "ha_sphinx") +-MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES mysys) ++MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE MODULE_ONLY SKIP_PROBES LINK_LIBRARIES mysys) + ENDIF() +--- Percona-Server-5.5.32-rel31.0/plugin/percona-pam-for-mysql/CMakeLists.txt.orig 2013-07-01 05:16:34.000000000 +0200 ++++ Percona-Server-5.5.32-rel31.0/plugin/percona-pam-for-mysql/CMakeLists.txt 2013-07-12 18:28:41.576588784 +0200 +@@ -31,6 +31,6 @@ + SET(AUTH_PAM_COMPAT_SOURCES ${AUTH_PAM_COMMON_SOURCES} src/auth_pam_compat.c) + MYSQL_ADD_PLUGIN(auth_pam ${AUTH_PAM_SOURCES} LINK_LIBRARIES pam MODULE_ONLY) + MYSQL_ADD_PLUGIN(auth_pam_compat ${AUTH_PAM_COMPAT_SOURCES} LINK_LIBRARIES pam MODULE_ONLY) +- MYSQL_ADD_PLUGIN(dialog src/dialog.c LINK_LIBRARIES mysqlclient MODULE_ONLY) ++ MYSQL_ADD_PLUGIN(dialog src/dialog.c LINK_LIBRARIES mysqlclient MODULE_ONLY SKIP_PROBES) + ENDIF(HAVE_PAM AND HAVE_GETPWNAM_R AND HAVE_GETGRGID_R) + ENDIF(WITH_PAM) diff --git a/mysql-ndb-cpc.init b/mysql-ndb-cpc.init new file mode 100755 index 0000000..ad159b3 --- /dev/null +++ b/mysql-ndb-cpc.init @@ -0,0 +1,92 @@ +#!/bin/sh +# +# mysql-ndb-cpc This shell script takes care of starting and stopping mysql-ndb-cpc. +# +# chkconfig: 2345 80 30 +# description: mysql-ndb-cpc is a mysql NDB engine +# +# processname: ndbd + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Source oident configureation. +if [ -f /etc/sysconfig/mysql-ndb-cpc ]; then + . /etc/sysconfig/mysql-ndb-cpc +fi + +# Check that networking is up. +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down mysql-ndb-cpc + exit 1 + fi +else + exit 0 +fi + +start() { + # Start daemons. + if [ ! -f /var/lock/subsys/mysql-ndb-cpc ]; then + msg_starting "mysql ndb_cpcd" + daemon ndb_cpcd $MYSQL_NDB_CPC_OPT + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mysql-ndb-cpc + else + msg_already_running "mysql ndb_cpcd" + fi +} + +stop() { + # Stop daemons. + if [ -f /var/lock/subsys/mysql-ndb-cpc ]; then + msg_stopping "mysql ndb_cpcd" + killproc ndbd + rm -f /var/lock/subsys/mysql-ndb-cpc >/dev/null 2>&1 + else + msg_not_running "mysql ndb_cpcd" + fi +} + +condrestart() { + if [ -f /var/lock/subsys/mysql-ndb-cpc ]; then + stop + start + else + msg_not_running "mysql ndb_cpcd" + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + status) + status ndb_cpcd + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 +esac + +exit $RETVAL diff --git a/mysql-ndb-cpc.sysconfig b/mysql-ndb-cpc.sysconfig new file mode 100644 index 0000000..d6ad0c9 --- /dev/null +++ b/mysql-ndb-cpc.sysconfig @@ -0,0 +1,2 @@ +MYSQL_NDB_CPC_OPT="" +SERVICE_RUN_NICE_LEVEL="+0" diff --git a/mysql-ndb-mgm.init b/mysql-ndb-mgm.init new file mode 100755 index 0000000..0f9681c --- /dev/null +++ b/mysql-ndb-mgm.init @@ -0,0 +1,92 @@ +#!/bin/sh +# +# mysql-ndb-mgm This shell script takes care of starting and stopping mysql-ndb-mgm. +# +# chkconfig: 2345 80 30 +# description: mysql-ndb-mgm is a mysql NDB engine +# +# processname: ndbd + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Source oident configureation. +if [ -f /etc/sysconfig/mysql-ndb-mgm ]; then + . /etc/sysconfig/mysql-ndb-mgm +fi + +# Check that networking is up. +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down mysql-ndb-mgm + exit 1 + fi +else + exit 0 +fi + +start() { + # Start daemons. + if [ ! -f /var/lock/subsys/mysql-ndb-mgm ]; then + msg_starting "mysql ndb_mgmd" + daemon ndb_mgmd $MYSQL_NDB_MGM_OPT + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mysql-ndb-mgm + else + msg_already_running "mysql ndb_mgmd" + fi +} + +stop() { + # Stop daemons. + if [ -f /var/lock/subsys/mysql-ndb-mgm ]; then + msg_stopping "mysql ndb_mgmd" + killproc ndbd + rm -f /var/lock/subsys/mysql-ndb-mgm >/dev/null 2>&1 + else + msg_not_running "mysql ndb_mgmd" + fi +} + +condrestart() { + if [ -f /var/lock/subsys/mysql-ndb-mgm ]; then + stop + start + else + msg_not_running "mysql ndb_mgmd" + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + status) + status ndb_mgmd + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 +esac + +exit $RETVAL diff --git a/mysql-ndb-mgm.sysconfig b/mysql-ndb-mgm.sysconfig new file mode 100644 index 0000000..fc4936f --- /dev/null +++ b/mysql-ndb-mgm.sysconfig @@ -0,0 +1,2 @@ +MYSQL_NDB_MGM_OPT="" +SERVICE_RUN_NICE_LEVEL="+0" diff --git a/mysql-ndb.init b/mysql-ndb.init new file mode 100755 index 0000000..0374a48 --- /dev/null +++ b/mysql-ndb.init @@ -0,0 +1,92 @@ +#!/bin/sh +# +# mysql-ndb This shell script takes care of starting and stopping mysql-ndb. +# +# chkconfig: 2345 80 30 +# description: mysql-ndb is a mysql NDB engine +# +# processname: ndbd + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Source oident configureation. +if [ -f /etc/sysconfig/mysql-ndb ]; then + . /etc/sysconfig/mysql-ndb +fi + +# Check that networking is up. +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down mysql-ndb + exit 1 + fi +else + exit 0 +fi + +start() { + # Start daemons. + if [ ! -f /var/lock/subsys/mysql-ndb ]; then + msg_starting "mysql ndbd" + daemon ndbd $MYSQL_NDB_OPT + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mysql-ndb + else + msg_already_running "mysql ndbd" + fi +} + +stop() { + # Stop daemons. + if [ -f /var/lock/subsys/mysql-ndb ]; then + msg_stopping "mysql ndbd" + killproc ndbd + rm -f /var/lock/subsys/mysql-ndb >/dev/null 2>&1 + else + msg_not_running "mysql ndbd" + fi +} + +condrestart() { + if [ -f /var/lock/subsys/mysql-ndb ]; then + stop + start + else + msg_not_running "mysql ndbd" + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + status) + status ndbd + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 +esac + +exit $RETVAL diff --git a/mysql-ndb.sysconfig b/mysql-ndb.sysconfig new file mode 100644 index 0000000..8b93682 --- /dev/null +++ b/mysql-ndb.sysconfig @@ -0,0 +1,2 @@ +MYSQL_NDB_OPT="" +SERVICE_RUN_NICE_LEVEL="+0" diff --git a/mysql-sphinx.patch b/mysql-sphinx.patch new file mode 100644 index 0000000..dac55bd --- /dev/null +++ b/mysql-sphinx.patch @@ -0,0 +1,33 @@ +--- mysql-5.1.49/storage/sphinx/Makefile.am~ 2009-02-13 23:26:46.000000000 +0200 ++++ mysql-5.1.49/storage/sphinx/Makefile.am 2010-07-24 16:35:57.568716704 +0300 +@@ -31,7 +31,7 @@ + LDADD = + + DEFS= @DEFS@ \ +- -D_REENTRANT -D_PTHREADS -DENGINE -DSTORAGE_ENGINE -DMYSQL_SERVER ++ -D_REENTRANT -D_PTHREADS -DSTORAGE_ENGINE -DMYSQL_SERVER + + noinst_HEADERS = ha_sphinx.h + +--- mysql-5.1.49/storage/sphinx/Makefile.am~ 2010-07-24 16:37:48.000000000 +0300 ++++ mysql-5.1.49/storage/sphinx/Makefile.am 2010-07-24 17:00:56.161565823 +0300 +@@ -38,7 +38,7 @@ + EXTRA_LTLIBRARIES = ha_sphinx.la + pkgplugin_LTLIBRARIES = @plugin_sphinx_shared_target@ sphinx.la + +-ha_sphinx_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ++ha_sphinx_la_LDFLAGS = -module -avoid-version -rpath $(MYSQLLIBdir) + ha_sphinx_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + ha_sphinx_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + ha_sphinx_la_SOURCES = ha_sphinx.cc +--- mysql-5.1.49/storage/sphinx/Makefile.am~ 2010-07-24 19:14:55.000000000 +0300 ++++ mysql-5.1.49/storage/sphinx/Makefile.am 2010-07-25 03:47:56.660771099 +0300 +@@ -43,7 +43,7 @@ + ha_sphinx_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + ha_sphinx_la_SOURCES = ha_sphinx.cc + +-sphinx_la_LDFLAGS = -module ++sphinx_la_LDFLAGS = -module -avoid-version -rpath $(MYSQLLIBdir) + sphinx_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + sphinx_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + sphinx_la_SOURCES = snippets_udf.cc diff --git a/mysql-system-users.patch b/mysql-system-users.patch new file mode 100644 index 0000000..34b360c --- /dev/null +++ b/mysql-system-users.patch @@ -0,0 +1,34 @@ +--- mysql-5.5.8/scripts/mysql_system_tables_data.sql.org 2010-12-16 00:09:23.662631925 +0100 ++++ mysql-5.5.8/scripts/mysql_system_tables_data.sql 2010-12-16 00:10:17.763454969 +0100 +@@ -27,23 +27,17 @@ + SET @get_hostname= @@hostname; + SELECT REPLACE((SELECT REPLACE(@get_hostname,'_','\_')),'%','\%') INTO @current_hostname; + +- +--- Fill "db" table with default grants for anyone to +--- access database 'test' and 'test_%' if "db" table didn't exist +-CREATE TEMPORARY TABLE tmp_db LIKE db; +-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); +-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); +-INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; +-DROP TABLE tmp_db; +- +- + -- Fill "user" table with default users allowing root access + -- from local machine if "user" table didn't exist before + CREATE TEMPORARY TABLE tmp_user LIKE user; +-INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',''); +-REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost'; +-REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',''); +-REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',''); ++INSERT INTO tmp_user VALUES ('localhost','mysql','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',''); ++REPLACE INTO tmp_user SELECT @current_hostname,'mysql','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost'; ++REPLACE INTO tmp_user VALUES ('127.0.0.1','mysql','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',''); ++REPLACE INTO tmp_user VALUES ('::1','mysql','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',''); ++INSERT INTO tmp_user VALUES ('localhost','mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0,'',''); ++REPLACE INTO tmp_user SELECT @current_hostname,'mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost'; ++REPLACE INTO tmp_user VALUES ('127.0.0.1','mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0,'',''); ++REPLACE INTO tmp_user VALUES ('::1','mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0,'',''); + INSERT INTO tmp_user (host,user) VALUES ('localhost',''); + INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost'; + INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; diff --git a/mysql-upgrade.patch b/mysql-upgrade.patch new file mode 100644 index 0000000..397747c --- /dev/null +++ b/mysql-upgrade.patch @@ -0,0 +1,36 @@ +--- mysql-5.5.32/client/mysql_upgrade.c.orig 2013-07-01 03:16:34.000000000 +0000 ++++ mysql-5.5.32/client/mysql_upgrade.c 2013-07-09 16:15:08.366178596 +0000 +@@ -35,13 +35,13 @@ + # endif + #endif + +-static char mysql_path[FN_REFLEN]; +-static char mysqlcheck_path[FN_REFLEN]; ++static char *mysql_path = "/usr/bin/mysql"; ++static char *mysqlcheck_path = "/usr/sbin/mysqlcheck"; + + static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag, + opt_systables_only, opt_version_check; + static uint my_end_arg= 0; +-static char *opt_user= (char*)"root"; ++static char *opt_user= (char*)"mysql"; + + static DYNAMIC_STRING ds_args; + static DYNAMIC_STRING conn_args; +@@ -923,15 +923,7 @@ + dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS); + dynstr_append(&ds_args, " "); + +- /* Find mysql */ +- find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); +- +- if (!opt_systables_only) +- { +- /* Find mysqlcheck */ +- find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); +- } +- else ++ if (opt_systables_only) + { + printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); + } diff --git a/mysql.init b/mysql.init new file mode 100755 index 0000000..ab32354 --- /dev/null +++ b/mysql.init @@ -0,0 +1,730 @@ +#!/bin/sh +# +# mysql A very fast and reliable SQL database engine +# +# chkconfig: 2345 84 25 +# +# description: A very fast and reliable SQL database engine. + +# Source function library +. /etc/rc.d/init.d/functions + +# Get network config +. /etc/sysconfig/network + +# Get service config +if [ -f /etc/sysconfig/mysql ]; then + . /etc/sysconfig/mysql +else + nls "Error: %s not found" /etc/sysconfig/mysql + nls "%s can't be run." MySQL + exit 1 +fi + +if [ -n "$MYSQL_DB_CLUSTERS" ]; then + nls "Warning: MYSQL_DB_CLUSTERS is set. It's obsolete. Use %s instead." /etc/mysql/clusters.conf +fi + +if [ -f /etc/mysql/clusters.conf ]; then + MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/ && /=/{print $2}' /etc/mysql/clusters.conf) + if [ -z "$MYSQL_DB_CLUSTERS" ]; then + nls "Warning: there are no configured clusters." + fi + +else + nls "Warning: Missing clusters config file %s" /etc/mysql/clusters.conf + if [ -z "$MYSQL_DB_CLUSTERS" ]; then + nls "Warning: there are no configured clusters." + nls "Using default cluster /var/lib/mysql (compatibility mode)" + MYSQL_DB_CLUSTERS=/var/lib/mysql + fi +fi + + +# Check that networking is up +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then + msg_network_down MySQL + exit 1 + fi +else + exit 0 +fi + +action="$1" + +# any db cluster as command line argument? +if [ $# -gt 1 ]; then + shift + # perform action for specified clusters only + for a in "$@"; do + # try auto resolving from /etc/mysql/clusters.conf + if [[ "$a" != /* ]]; then + m=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $1}' /etc/mysql/clusters.conf) + if [ -z "$m" ]; then + echo >&2 "Cluster name '$a' did not match anything!" + exit 1 + fi + if [ $(echo "$m" | wc -l) -gt 1 ]; then + echo >&2 "Cluster name '$a' ambiguous:" $m + exit 1 + fi + a=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $2}' /etc/mysql/clusters.conf) + fi + DB_CLUSTERS="$DB_CLUSTERS $a" + done +else + DB_CLUSTERS="$MYSQL_DB_CLUSTERS" +fi + +# global error log, if mysqld.conf hasn't migrated to log-error style +MYSQL_ERRLOG=/var/log/mysql/mysqld.log +MYSQL_STOP_WAIT_TIME=${MYSQL_STOP_WAIT_TIME:-900} + +# +# Useful functions. +# + +# +# check for mysql status +# +# arguments: +# $1 - db cluster +# $2 - start|stop +# +# sets variables: +# MYSQL_STATUS = starting | running | not running | died +# MYSQL_PID = pid of mysqld process +# +mysqlstatus() { + clusterdir="$1" + mode="$2" + + mysqlgetconfig "$clusterdir" status + + MYSQL_STATUS="not running" + MYSQL_PID="unknown" + MYSQL_PIDFILE_PID="" + MYSQL_GREP_PID="" + + if [ -f "$MYSQL_PIDFILE" ]; then + MYSQL_PIDFILE_PID=$(cat "$MYSQL_PIDFILE") + fi + + if [ -n "$MYSQL_PIDFILE_PID" ]; then + MYSQL_PID=$MYSQL_PIDFILE_PID + if [ ! -d "/proc/$MYSQL_PID" ]; then + MYSQL_STATUS="died" + return + elif (grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null); then + MYSQL_STATUS="running" + return + fi + fi + + if [ "$mode" = "start" ]; then + MYSQL_GREP_PID=$(grep -lE "^/usr/sbin/mysqld.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }') + if [ -n "$MYSQL_GREP_PID" ]; then + MYSQL_PID=$MYSQL_GREP_PID + if grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null; then + if [ -f "$MYSQL_PIDFILE" ]; then + MYSQL_PIDFILE_PID=$(cat "$MYSQL_PIDFILE") + fi + if [ -n "$MYSQL_PIDFILE_PID" ]; then + MYSQL_PID=$MYSQL_PIDFILE_PID + MYSQL_STATUS="running" + return + else + MYSQL_STATUS="starting" + return + fi + fi + fi + fi + + # else default, "not running" +} + +# get mysql configuration in variables +# MYSQL_CONFIG MYSQL_CLUSTER_DIR +# MYSQL_DATA_DIR MYSQL_USER MYSQL_PIDFILE MYSQL_SOCKET MYSQL_PORT MYSQL_BIND_ADDRESS MYSQL_SKIP_NETWORKING MYSQL_LOG_ERROR +# +# arguments +# $1 - db cluster +# $2 - status | other + +mysqlgetconfig() { + local clusterdir="$1" config_file + local mode="$2" + + # emulate old behaviour if only one cluster specified + if [ "$clusterdir" = "$MYSQL_DB_CLUSTERS" -a "$clusterdir" = "/var/lib/mysql" -a -f /etc/mysqld.conf ]; then + MYSQL_RA_COMPAT=yes + config_file=/etc/mysqld.conf + else + local config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mysql/clusters.conf) + if [[ $config = /* ]]; then + config_file="$config" + elif [ -f "/etc/mysql/$config" ]; then + config_file="/etc/mysql/$config" + else + config_file="$clusterdir/mysqld.conf" + fi + fi + + MYSQL_CLUSTER_DIR="$clusterdir" + + if [ -z "$config_file" ]; then + nls "Error: Can't find config file for %s cluster" "$clusterdir" + if [ "$mode" = "status" ]; then + exit 3 + else + exit 6 + fi + else + MYSQL_CONFIG="$config_file" + fi + + if [ ! -f "$config_file" ]; then + nls "Error: config file %s not found" "$config_file" + nls "MySQL can't be run. Did you initialize DB by doing \`$0 init'?" + if [ "$mode" = "status" ]; then + exit 3 + else + exit 6 + fi + fi + + # reset to initial state + MYSQL_DATA_DIR= MYSQL_USER= MYSQL_PIDFILE= MYSQL_SOCKET= MYSQL_PORT= MYSQL_BIND_ADDRESS= MYSQL_SKIP_NETWORKING= MYSQL_LOG_ERROR= + + eval `awk -F= ' + { + # undos + gsub(/\r$/, ""); + + # trim spaces + gsub(/^[\t ]+|[\t ]+$/, "", $1); + gsub(/^[\t ]+|[\t ]+$/, "", $2); + } + + # skip comments and empty lines + /^[;#]|^ *$/ { next } + + /^[ \t]*\[.*\][ \t]*$/ { + match($0, /\[.*\]/); + section = substr($0, RSTART + 1, RSTART + RLENGTH - 3); + next; + } + + section == "mysqld" { + if ($1 == "datadir") { + printf("MYSQL_DATA_DIR=%s;", $2); + } else if ($1 == "user") { + printf("MYSQL_USER=%s;", $2); + } else if ($1 == "pid-file") { + printf("MYSQL_PIDFILE=%s;", $2); + } else if ($1 == "socket") { + printf("MYSQL_SOCKET=%s;", $2); + } else if ($1 == "port") { + printf("MYSQL_PORT=%s;", $2); + } else if ($1 == "bind-address") { + printf("MYSQL_BIND_ADDRESS=%s;", $2); + } else if ($1 == "skip-networking") { + printf("MYSQL_SKIP_NETWORKING=1;"); + } else if ($1 == "log-error") { + printf("MYSQL_LOG_ERROR=%s;", $2); + } + } + ' $config_file` + + # error log not defined in config file. add one + if [ -z "$MYSQL_LOG_ERROR" ]; then + MYSQL_LOG_ERROR=$MYSQL_ERRLOG + else + # unset, so mysqld would use value from config itself + unset MYSQL_LOG_ERROR + fi + + if is_yes "$MYSQL_RA_COMPAT"; then + MYSQL_DATA_DIR_SUB="" + else + MYSQL_DATA_DIR_SUB="/mysqldb" + fi + + if [ -z "$MYSQL_DATA_DIR" -o "$MYSQL_DATA_DIR" != "${clusterdir}${MYSQL_DATA_DIR_SUB}/db" ]; then + nls "Error: datadir specified in %s should be %s" "$config_file" "$clusterdir${MYSQL_DATA_DIR_SUB}/db" + nls " MySQL can't be run." + exit 6 + fi + + if [ -z "$MYSQL_PIDFILE" -o "$MYSQL_PIDFILE" != "$clusterdir${MYSQL_DATA_DIR_SUB}/mysql.pid" ]; then + nls "Error: pid-file specified in %s should be %s" "$config_file" "$clusterdir${MYSQL_DATA_DIR_SUB}/mysql.pid" + nls " MySQL can't be run." + exit 6 + fi + + if [ -z "$MYSQL_USER" ]; then + echo "$(nls 'MySQL user not configured properly')"'!' >&2 + nls "Edit %s and configure it." "$config_file" >&2 + exit 6 + fi +} + +# start mysql +mysqlstart() { + local clusterdir="$1" + mysqlgetconfig "$clusterdir" + if [ ! -d "$MYSQL_DATA_DIR/mysql" ]; then + nls "MySQL cluster %s not initialized." "$clusterdir" + nls "Try \`%s init %s' before start." "$0" "$clusterdir" + exit 6 + fi + + msg_starting "MySQL $clusterdir"; busy + [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0 + rm -f "$MYSQL_PIDFILE" + + + TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \ + /usr/bin/setsid /usr/sbin/mysqld \ + --defaults-file=$MYSQL_CONFIG \ + --datadir=$MYSQL_DATA_DIR \ + --pid-file=$MYSQL_PIDFILE \ + ${MYSQL_LOG_ERROR:+--log-error="$MYSQL_LOG_ERROR"} \ + $MYSQL_OPTIONS & + pid=$! + + sleep 0.1 + mysqlstatus "$clusterdir" start + # it takes longer for mysqld to start and create pidfile if it has to recover innodb transactions + if [ "$MYSQL_STATUS" = "starting" ]; then + echo "" + show "Waiting for MySQL to start" + busy + + # while the pid is running, mysql is starting up + # if the pidfile was created, it started up successfully + # if either case fails we break and report status + while true; do + [ -d /proc/$pid ] || break + [ -f "$MYSQL_PIDFILE" ] && break + sleep 0.2 + done + fi + + mysqlstatus "$clusterdir" start + if [ "$MYSQL_STATUS" = "running" -a "$MYSQL_PID" != "unknown" ]; then + ok + elif [ "$MYSQL_STATUS" = "died" ]; then + RETVAL=1 + died + else + RETVAL=1 + fail + fi +} + +# stop mysql +mysqlstop() { + local clusterdir="$1" + mysqlstatus "$clusterdir" stop + msg_stopping "MySQL $clusterdir" + busy + + # try graceful shutdown -- send shutdown command + # requires mysql_sysadmin user proper privs + /usr/bin/mysqladmin --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown >/dev/null 2>&1 + mysqlstatus "$clusterdir" stop + + if [ "$MYSQL_PID" != "unknown" ]; then + kill -TERM "$MYSQL_PID" 2> /dev/null + for nr in $(seq 1 $(($MYSQL_STOP_WAIT_TIME*10))); do + [ -d "/proc/$MYSQL_PID" ] || break + sleep 0.1 + done + fi + + mysqlstatus "$clusterdir" stop + if [ "$MYSQL_STATUS" = "died" ]; then + died + elif [ "$MYSQL_STATUS" = "running" -o "$MYSQL_STATUS" = "starting" ]; then + fail + else + ok + fi +} + +# report slave status +# uses MYSQL_SOCKET - path to mysql socket +slave_status() { + # see if slave status can be reported + local err=0 slave_status=$(mysql --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" -e 'show slave status\G') + if [ -z "$slave_status" ]; then + # slave not setup + return + fi + + printf "Slave Status:\n" + + set -f + eval $(echo "$slave_status" | awk -F': ' '/^ *[A-Za-z_]+:/{ + k = tolower($1); + v = substr($0, length($1) + 3); + gsub(/\\/, "\\\\\\", v); + gsub(/"/, "\\\"", v); + gsub(/`/, "\\`", v); + gsub(/\$/, "\\$", v); + gsub(/\$/, "\\$", v); + printf("%s=\"%s\";\n", k, v); + }') + set +f + + if [ "$slave_io_running" != "Yes" ]; then + printf "\tSlave IO not running\n" + err=1 + fi + if [ "$slave_sql_running" != "Yes" ]; then + printf "\tSlave SQL not running\n" + err=1 + fi + + if [ "$err" = 1 -a "$last_errno" -gt 0 ]; then + printf "\tERROR %s: %s\n" "$last_errno" "$last_error" + fi + + if [ "$master_log_file" != "$relay_master_log_file" ]; then + printf "\tERROR logfile mismatch (%s)\n" "$relay_master_log_file" + err=1 + fi + + if [ -z "$read_master_log_pos" -o -z "$exec_master_log_pos" ]; then + printf "\tERROR No info about master\n" + err=1 + return + fi + + diff=$(($read_master_log_pos - $exec_master_log_pos)) + printf "\tread pos: %s (%s) (host: %s:%d)\n" "$read_master_log_pos" "$master_log_file" "$master_host" "$master_port" + printf "\texec pos: %s\n" "$exec_master_log_pos" + printf "\tdiff: %s\n" "$diff" +} + +# +# check for running mysql instances; if any instance is running then +# create subsys lock file +# +mysqlsubsys() { + # check for every defined db cluster in sysconfig file + for mysqldir in $DB_CLUSTERS; do + mysqlstatus "$mysqldir" + if [ "$MYSQL_STATUS" = "running" ]; then + touch /var/lock/subsys/mysql + return + fi + done + rm -f /var/lock/subsys/mysql +} + +mysqlinit() { + local clusterdir="$1" + + if [ -f /etc/mysqld.conf ]; then + nls "Running in \`no cluster compat' mode: can't initialize database." + nls "Move /etc/mysqld.conf away and rerun \`$0 init' (new config will be in $clusterdir)." + exit 1 + fi + + if [ -f "$clusterdir/mysqld.conf" ]; then + mysqlgetconfig "$clusterdir" + else + MYSQL_USER="mysql" + MYSQL_CLUSTER_DIR="$clusterdir" + MYSQL_DATA_DIR="$clusterdir/mysqldb/db" + MYSQL_PIDFILE="$clusterdir/mysqldb/mysql.pid" + MYSQL_SOCKET="$clusterdir/mysqldb/mysql.sock" + + # this $MYSQL_CONFIG will be created later + MYSQL_CONFIG="$MYSQL_CLUSTER_DIR/mysqld.conf" + fi + + show "Initializing cluster %s" "$clusterdir"; started + + # Check if not exist init database + if [ -d "$MYSQL_DATA_DIR/mysql" ]; then + nls "Seems that database is initialized now. Remove by hand %s" "$MYSQL_DATA_DIR/mysql" + nls "before initializing database." + nls "For now skipping cluster %s." "$clusterdir" + return + fi + + show "Installing MySQL system tables for $MYSQL_DATA_DIR" + busy + TMP=/tmp TMPDIR=/tmp + + mkdir -p "$MYSQL_DATA_DIR" > /dev/null 2>&1 + # Using mysql:mysql for MYSQL_CLUSTER_DIR is creating SECURITY hole, root:root is proper + chown root:root "$MYSQL_CLUSTER_DIR" + chown mysql:mysql "$MYSQL_CLUSTER_DIR/mysqldb" "$MYSQL_DATA_DIR" > /dev/null 2>&1 + chmod 751 "$MYSQL_CLUSTER_DIR" "$MYSQL_CLUSTER_DIR/mysqldb" + + if [ -f /usr/share/mysql/mysqld.conf -a ! -f "$MYSQL_CLUSTER_DIR/mysqld.conf" ]; then + sed -e " + s#\(datadir.*\)=.*#\1= $MYSQL_DATA_DIR#g; + s#\(pid-file.*\)=.*#\1= $MYSQL_PIDFILE#g; + s#\(socket.*\)=.*#\1= $MYSQL_SOCKET#g; + s#@clusterdir@#$MYSQL_CLUSTER_DIR#g; + " /usr/share/mysql/mysqld.conf > "$MYSQL_CLUSTER_DIR/mysqld.conf" + chown root:root "$MYSQL_CLUSTER_DIR/mysqld.conf" + chmod 640 "$MYSQL_CLUSTER_DIR/mysqld.conf" + fi + + if [ ! -e /var/lib/mysql/mysql.sock ] || [ -L /var/lib/mysql/mysql.sock ] && [ -z "$(readlink /var/lib/mysql/mysql.sock)" ]; then + sock=${MYSQL_SOCKET#/var/lib/mysql/} # make it relative if possible + ln -s "$sock" /var/lib/mysql/mysql.sock + fi + + cat > $MYSQL_DATA_DIR/mysql-init.sql <<-EOF + CREATE DATABASE mysql; + use mysql; + $(cat /usr/share/mysql/mysql_system_tables.sql) + $(sed -e "/@current_hostname/d" /usr/share/mysql/mysql_system_tables_data.sql) +EOF + + ok=0 + /usr/sbin/mysqld \ + --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \ + --bootstrap \ + --skip-grant-tables \ + --datadir=$MYSQL_DATA_DIR \ + --user=$MYSQL_USER \ + --slave-load-tmpdir=$MYSQL_DATA_DIR \ + --tmpdir=$MYSQL_DATA_DIR \ + --log-error=$MYSQL_ERRLOG \ + < $MYSQL_DATA_DIR/mysql-init.sql && ok=1 + [ -f $MYSQL_DATA_DIR/mysql/host.frm ] || ok=0 + + if [ "$ok" = 1 ]; then + rm -f $MYSQL_DATA_DIR/mysql-init.sql + ok + cat << END_OF_MSG + +PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL USERS! +This is done, after starting database, in the order shown, +with: + +For 'mysql_sysadmin' (RELOAD and SHUTDOWN privileges): +echo "update mysql.user set password=password('newpassword') where user='mysql_sysadmin'; FLUSH PRIVILEGES;" | mysql -u mysql -S $MYSQL_SOCKET + +For 'mysql' user (ALL privileges, DB admin): +echo "update mysql.user set password=password('newpassword') where user='mysql'; FLUSH PRIVILEGES;" | mysql -u mysql -S $MYSQL_SOCKET + +NOTE: mysql_sysadmin password should be placed to $MYSQL_CONFIG in +mysqladmin section. See the manual for more instructions. +(This user is used at logs rotation and server shutdown) + +END_OF_MSG + show "Filling help tables..." + ok=0 + ( echo "use mysql;"; cat /usr/share/mysql/fill_help_tables.sql ) | \ + /usr/sbin/mysqld \ + --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \ + --bootstrap \ + --skip-grant-tables \ + --datadir=$MYSQL_DATA_DIR \ + --user=$MYSQL_USER \ + --slave-load-tmpdir=$MYSQL_DATA_DIR \ + --tmpdir=$MYSQL_DATA_DIR \ + --log-error=$MYSQL_ERRLOG \ + && ok=1 + if [ "$ok" = 1 ]; then + ok + else + cat << END_OF_MSG + +WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED! +The "HELP" command might not work properly. + +END_OF_MSG + fi + else + fail + cat << END_OF_MSG +ERROR: +ERROR: +ERROR: Installation of grant tables FAILED! +ERROR: +ERROR: + +The initialization SQL script was preserved at $MYSQL_DATA_DIR/mysql-init.sql + +Examine the logs in /var/log/mysql for more information. You can +also try to start the mysqld daemon with: + +/usr/sbin/mysqld --skip-grant & + +You can use the command line tool mysql to connect to the mysql +database and look at the grant tables: + +shell> mysql -u mysql mysql +mysql> show tables + +Try 'mysqld --help' if you have problems with paths. Setting on +logging in $MYSQL_DATA_DIR/mysqld.conf gives you a log in /var/log/mysql/query.log that +may be helpful. The latest information about MySQL is available on the +web at http://www.mysql.com/. + +Please check PLD Linux ftp site for newer versions of this package. + +Please consult the MySQL manual section: 'Problems running +mysql_install_db', and the manual section that describes problems on +your OS. Another information source is the MySQL email archive. + +END_OF_MSG + exit 1 + fi +} + +# +# End of useful functions. +# + +start() { + local mysqldir + for mysqldir in $DB_CLUSTERS; do + mysqlstatus "$mysqldir" start + if [ "$MYSQL_STATUS" = "running" ]; then + msg_already_running "MySQL $mysqldir" + else + mysqlstart "$mysqldir" + fi + done + mysqlsubsys +} + +stop() { + local mysqldir + for mysqldir in $DB_CLUSTERS; do + mysqlstatus "$mysqldir" stop + if [ "$MYSQL_STATUS" = "not running" ]; then + msg_not_running "MySQL $mysqldir" + else + mysqlstop "$mysqldir" + fi + done + mysqlsubsys +} + +condrestart() { + if [ ! -f /var/lock/subsys/mysql ]; then + msg_not_running "MySQL" + RETVAL=$1 + return + fi + + stop + start +} + +status() { + local mysqldir addr port socket pid pids running datadir + RETVAL=3 + for mysqldir in $DB_CLUSTERS; do + mysqlstatus "$mysqldir" + if [ "$MYSQL_STATUS" = "running" ]; then + RETVAL=0 + addr=${MYSQL_BIND_ADDRESS:-0.0.0.0} + port=${MYSQL_PORT:-3306} + socket=${MYSQL_SOCKET:-/var/lib/mysql/mysql.sock} + pid=$MYSQL_PID + nls "MySQL cluster %s, pid %s\n" "$mysqldir" "$pid" + [ -z "$MYSQL_SKIP_NETWORKING" ] && nls "\ttcp:%s:%s\n" "$addr" "$port" + nls "\tunix: %s\n" "$socket" + + MYSQL_SOCKET=$socket slave_status + + pids="$pids/$MYSQL_PID/" + progress "$MYSQL_STATUS" + else + show "MySQL cluster %s" "$mysqldir" + progress "$MYSQL_STATUS" "$CFAIL" + fi + echo + done + + for pid in $(/sbin/pidof mysqld); do + if [[ $pids != */$pid/* ]]; then + running="$running $pid" + fi + done + + if [ $# = 1 -a "$running" ]; then + nls "Warning: MySQL Daemon processes not under clusters.conf control:" + # see if we can display their status + for pid in $running; do + datadir=$(cat /proc/$pid/cmdline | tr '\0' '\n' | fgrep -- --datadir=) + datadir=${datadir#--datadir=} # strip --datadir + mysqldir=${datadir%/mysqldb/db} # strip /mysqldb/db + mysqlstatus "$mysqldir" + if [ "$MYSQL_STATUS" = "running" ]; then + addr=${MYSQL_BIND_ADDRESS:-0.0.0.0} + port=${MYSQL_PORT:-3306} + socket=${MYSQL_SOCKET:-/var/lib/mysql/mysql.sock} + nls "MySQL cluster %s, pid %s\n" "$mysqldir" "$pid" + [ -z "$MYSQL_SKIP_NETWORKING" ] && nls "\ttcp:%s:%s\n" "$addr" "$port" + nls "\tunix: %s\n" "$socket" + + MYSQL_SOCKET=$socket slave_status + + progress "$MYSQL_STATUS" + else + show "MySQL cluster %s" "$mysqldir" + progress "$MYSQL_STATUS" "$CFAIL" + fi + echo + done + fi +} + +RETVAL=0 +case "$action" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + init) + for mysqldir in $DB_CLUSTERS; do + mysqlinit "$mysqldir" + done + exit $? + ;; + flush-logs) + for mysqldir in $DB_CLUSTERS; do + mysqlgetconfig "$mysqldir" + # just if mysqld is really running + if /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" ping >/dev/null 2>&1; then + /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" flush-logs + fi + done + ;; + status) + status + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|init|flush-logs|status}" + exit 3 +esac + +exit $RETVAL diff --git a/mysql.logrotate b/mysql.logrotate new file mode 100644 index 0000000..4bb78ce --- /dev/null +++ b/mysql.logrotate @@ -0,0 +1,34 @@ +# This section is used from mysqld.conf for logrotation. +# Be sure that the password in config matches the actual one. +# +# ATTENTION: The mysqld.conf should be readable ONLY for *system* root! +# +# [mysqladmin] +# user = mysql_sysadmin +# password = +# +# where "" is the password. +# +# You must do this for every active cluster defined in /etc/mysql/clusters.conf + +/var/log/mysql/query.log +/var/log/mysql/mysqld.log +/var/log/mysql/slow.log +/var/log/mysql/update* +{ + olddir /var/log/archive/mysql + notifempty + missingok + create 640 mysql mysql + sharedscripts + + # NOTE: + # if you run the rotation less often than "daily" then the + # "expire-logs-days" mysqld server parameter may no longer work as you + # expect + daily + + postrotate + /sbin/service mysql flush-logs + endscript +} diff --git a/mysql.spec b/mysql.spec new file mode 100644 index 0000000..4dd93f1 --- /dev/null +++ b/mysql.spec @@ -0,0 +1,1140 @@ +# TODO: +# - mysqldump ... (invalid usage) prints to stdout not stderr (idiotic if you want to create dump and get usage in .sql) +# - http://bugs.mysql.com/bug.php?id=16470 +# - innodb are dynamic (= as plugins) ? +# - missing have_archive, have_merge +# - is plugin_dir lib64 safe? +# - Using NDB Cluster... could not find sci transporter in /{include, lib} +# - !!! Makefiles for libmysqld.so !!! +# - segfaults on select from non-mysql user (caused by builder environment): +# https://bugs.launchpad.net/pld-linux/+bug/381904 +# (profiling disabled temporaily to workaround this) +# +# Conditional build: +%bcond_with autodeps # BR packages needed only for resolving deps +%bcond_without innodb # InnoDB storage engine support +%bcond_without big_tables # Support tables with more than 4G rows even on 32 bit platforms +%bcond_without federated # Federated storage engine support +%bcond_without raid # RAID support +%bcond_without ssl # OpenSSL support +%bcond_without systemtap # systemtap/dtrace probes +%bcond_without tcpd # libwrap (tcp_wrappers) support +%bcond_without sphinx # Sphinx storage engine support +%bcond_with tests # FIXME: don't run correctly +%bcond_with ndb # NDB is now a separate product, this here is broken, so disable it + +%define percona_rel 31.0 +%include /usr/lib/rpm/macros.perl +Summary: MySQL: a very fast and reliable SQL database engine +Summary(de.UTF-8): MySQL: ist eine SQL-Datenbank +Summary(fr.UTF-8): MySQL: un serveur SQL rapide et fiable +Summary(pl.UTF-8): MySQL: bardzo szybka i niezawodna baza danych (SQL) +Summary(pt_BR.UTF-8): MySQL: Um servidor SQL rápido e confiável +Summary(ru.UTF-8): MySQL - быстрый SQL-сервер +Summary(uk.UTF-8): MySQL - швидкий SQL-сервер +Summary(zh_CN.UTF-8): MySQL数据库服务器 +Name: mysql +Version: 5.5.32 +Release: 3 +License: GPL + MySQL FLOSS Exception +Group: Applications/Databases +# Source0Download: http://dev.mysql.com/downloads/mysql/5.5.html#downloads +# Source0: http://vesta.informatik.rwth-aachen.de/mysql/Downloads/MySQL-5.5/%{name}-%{version}.tar.gz +Source0: http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/Percona-Server-%{version}-rel%{percona_rel}.tar.gz +# Source0-md5: aafbc2a94353d68b5cbfbeddb7eb2e08 +Source100: http://www.sphinxsearch.com/files/sphinx-2.0.8-release.tar.gz +# Source100-md5: bcaf0af0ba403a43b9ef3af6f9599cb4 +Source1: %{name}.init +Source2: %{name}.sysconfig +Source3: %{name}.logrotate +Source4: %{name}d.conf +Source5: %{name}-clusters.conf +Source7: %{name}-ndb.init +Source8: %{name}-ndb.sysconfig +Source9: %{name}-ndb-mgm.init +Source10: %{name}-ndb-mgm.sysconfig +Source11: %{name}-ndb-cpc.init +Source12: %{name}-ndb-cpc.sysconfig +Source13: %{name}-client.conf +Source14: my.cnf +# from fedora +Source15: lib%{name}.version +Patch0: %{name}-link.patch +Patch2: %{name}hotcopy-5.0-5.5.patch +Patch3: bug-67402.patch +# from fedora +Patch6: %{name}-system-users.patch + +Patch9: %{name}-build.patch +Patch11: %{name}-upgrade.patch +Patch12: %{name}-config.patch +Patch14: %{name}-bug-43594.patch +Patch18: %{name}-sphinx.patch +Patch19: %{name}-chain-certs.patch +# from fedora +Patch20: %{name}-dubious-exports.patch +Patch21: bison3.patch +URL: http://www.mysql.com/products/community/ +BuildRequires: bison >= 1.875 +BuildRequires: cmake >= 2.6 +BuildRequires: groff +%if "%{pld_release}" == "ac" +BuildRequires: libstdc++4-devel >= 5:4.0 +%else +BuildRequires: libstdc++-devel >= 5:4.0 +%endif +BuildRequires: libtool +%{?with_tcpd:BuildRequires: libwrap-devel} +BuildRequires: ncurses-devel >= 4.2 +%{?with_ssl:BuildRequires: openssl-devel >= 0.9.7d} +%{?with_autodeps:BuildRequires: perl-DBI} +BuildRequires: perl-devel >= 1:5.6.1 +BuildRequires: readline-devel >= 4.2 +BuildRequires: rpm-perlprov >= 4.1-13 +BuildRequires: rpmbuild(macros) >= 1.597 +BuildRequires: sed >= 4.0 +%{?with_systemtap:BuildRequires: systemtap-sdt-devel} +BuildRequires: zlib-devel +Requires(post,preun): /sbin/chkconfig +Requires(postun): /usr/sbin/groupdel +Requires(postun): /usr/sbin/userdel +Requires(pre): /bin/id +Requires(pre): /usr/bin/getgid +Requires(pre): /usr/sbin/groupadd +Requires(pre): /usr/sbin/useradd +Requires(triggerpostun): sed >= 4.0 +Requires: %{name}-charsets = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} +Requires: /usr/bin/setsid +Requires: rc-scripts >= 0.2.0 +Suggests: mysql-client +%{?with_tcpd:Suggests: tcp_wrappers} +Suggests: vim-syntax-mycnf +Provides: MySQL-server +Provides: group(mysql) +Provides: msqlormysql +Provides: user(mysql) +Obsoletes: MySQL +Obsoletes: mysql-server +Conflicts: logrotate < 3.8.0 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%define _libexecdir %{_sbindir} +%define _localstatedir /var/lib/mysql +%define _mysqlhome /home/services/mysql + +%description +MySQL is a true multi-user, multi-threaded SQL (Structured Query +Language) database server. SQL is the most popular database language +in the world. MySQL is a client/server implementation that consists of +a server daemon mysqld and many different client programs/libraries. + +The main goals of MySQL are speed, robustness and easy to use. MySQL +was originally developed because we at Tcx needed a SQL server that +could handle very big databases with magnitude higher speed than what +any database vendor could offer to us. We have now been using MySQL +since 1996 in a environment with more than 40 databases, 10,000 +tables, of which more than 500 have more than 7 million rows. This is +about 50G of mission critical data. + +The base upon which MySQL is built is a set of routines that have been +used in a highly demanding production environment for many years. +While MySQL is still in development, it already offers a rich and +highly useful function set. + +%description -l fr.UTF-8 +MySQL est un serveur de bases de donnees SQL vraiment multi-usagers et +multi-taches. Le langage SQL est le langage de bases de donnees le +plus populaire au monde. MySQL est une implementation client/serveur +qui consiste en un serveur (mysqld) et differents +programmes/bibliotheques clientes. + +Les objectifs principaux de MySQL sont: vitesse, robustesse et +facilite d'utilisation. MySQL fut originalement developpe parce que +nous, chez Tcx, avions besoin d'un serveur SQL qui pouvait gerer de +tres grandes bases de donnees avec une vitesse d'un ordre de magnitude +superieur a ce que n'importe quel vendeur pouvait nous offrir. Nous +utilisons MySQL depuis 1996 dans un environnement avec plus de 40 +bases de donnees, 10000 tables, desquelles plus de 500 ont plus de 7 +millions de lignes. Ceci represente environ 50G de donnees critiques. + +A la base de la conception de MySQL, on retrouve une serie de routines +qui ont ete utilisees dans un environnement de production pendant +plusieurs annees. Meme si MySQL est encore en developpement, il offre +deja une riche et utile serie de fonctions. + +%description -l pl.UTF-8 +MySQL to prawdziwie wieloużytkownikowy, wielowątkowy serwer baz danych +SQL. SQL jest najpopularniejszym na świecie językiem używanym do baz +danych. MySQL to implementacja klient/serwer składająca się z demona +mysqld i wielu różnych programów i bibliotek klienckich. + +Głównymi celami MySQL-a są szybkość, potęga i łatwość użytkowania. +MySQL oryginalnie był tworzony, ponieważ autorzy w Tcx potrzebowali +serwera SQL do obsługi bardzo dużych baz danych z szybkością o wiele +większą, niż mogli zaoferować inni producenci baz danych. Używają go +od 1996 roku w środowisku z ponad 40 bazami danych, 10 000 tabel, z +których ponad 500 zawiera ponad 7 milionów rekordów - w sumie około +50GB krytycznych danych. + +Baza, na której oparty jest MySQL, składa się ze zbioru procedur, +które były używane w bardzo wymagającym środowisku produkcyjnym przez +wiele lat. Pomimo, że MySQL jest ciągle rozwijany, już oferuje bogaty +i użyteczny zbiór funkcji. + +%description -l de.UTF-8 +MySQL ist eine SQL-Datenbank. Allerdings ist sie im Gegensatz zu +Oracle, DB2 oder PostgreSQL keine relationale Datenbank. Die Daten +werden zwar in zweidimensionalen Tabellen gespeichert und können mit +einem Primärschlüssel versehen werden. Es ist aber keine Definition +eines Fremdschlüssels möglich. Der Benutzer ist somit bei einer +MySQL-Datenbank völlig allein für die (referenzielle) Integrität der +Daten verantwortlich. Allein durch die Nutzung externer +Tabellenformate, wie InnoDB bzw Berkeley DB wird eine Relationalität +ermöglicht. Diese Projekte sind aber getrennt von MySQL zu betrachten. + +%description -l pt_BR.UTF-8 +O MySQL é um servidor de banco de dados SQL realmente multiusuário e +multi-tarefa. A linguagem SQL é a mais popular linguagem para banco de +dados no mundo. O MySQL é uma implementação cliente/servidor que +consiste de um servidor chamado mysqld e diversos +programas/bibliotecas clientes. Os principais objetivos do MySQL são: +velocidade, robustez e facilidade de uso. O MySQL foi originalmente +desenvolvido porque nós na Tcx precisávamos de um servidor SQL que +pudesse lidar com grandes bases de dados e com uma velocidade muito +maior do que a que qualquer vendedor podia nos oferecer. Estamos +usando o MySQL desde 1996 em um ambiente com mais de 40 bases de dados +com 10.000 tabelas, das quais mais de 500 têm mais de 7 milhões de +linhas. Isto é o equivalente a aproximadamente 50G de dados críticos. +A base da construção do MySQL é uma série de rotinas que foram usadas +em um ambiente de produção com alta demanda por muitos anos. Mesmo o +MySQL estando ainda em desenvolvimento, ele já oferece um conjunto de +funções muito ricas e úteis. Veja a documentação para maiores +informações. + +%description -l ru.UTF-8 +MySQL - это SQL (Structured Query Language) сервер базы данных. MySQL +была написана Michael'ом (monty) Widenius'ом. См. файл CREDITS в +дистрибутиве на предмет других участников проекта и прочей информации +о MySQL. + +%description -l uk.UTF-8 +MySQL - це SQL (Structured Query Language) сервер бази даних. MySQL +було написано Michael'ом (monty) Widenius'ом. Див. файл CREDITS в +дистрибутиві для інформації про інших учасників проекту та іншої +інформації. + +%package charsets +Summary: MySQL - character sets definitions +Summary(pl.UTF-8): MySQL - definicje kodowań znaków +Group: Applications/Databases + +%description charsets +This package contains character sets definitions needed by both client +and server. + +%description charsets -l pl.UTF-8 +Ten pakiet zawiera definicje kodowań znaków potrzebne dla serwera i +klienta. + +%package -n mysqlhotcopy +Summary: mysqlhotcopy - A MySQL database backup program +Summary(pl.UTF-8): mysqlhotcopy - program do tworzenia kopii zapasowych baz MySQL +Group: Applications/Databases +Requires: perl-DBD-mysql + +%description -n mysqlhotcopy +mysqlhotcopy uses LOCK TABLES, FLUSH TABLES, and cp or scp to make a +database backup quickly. It is the fastest way to make a backup of the +database or single tables, but it can be run only on the same machine +where the database directories are located. mysqlhotcopy works only +for backing up MyISAM and ARCHIVE tables. + +See innobackup package to backup InnoDB tables. + +%description -n mysqlhotcopy -l pl.UTF-8 +mysqlhotcopy wykorzystuje LOCK TABLES, FLUSH TABLES oraz cp i scp do +szybkiego tworzenia kopii zapasowych baz danych. Jest to najszybszy +sposób wykonania kopii zapasowej bazy danych lub pojedynczych tabel, +ale może działać tylko na maszynie, na której znajdują się katalogi z +bazą danych. mysqlhotcopy działa tylko dla tabel typu MyISAM i +ARCHIVE. + +Narzędzie do tworzenia kopii tabel InnoDB znajduje się w pakiecie +innobackup. + +%package extras +Summary: MySQL additional utilities +Summary(pl.UTF-8): Dodatkowe narzędzia do MySQL +Group: Applications/Databases +Requires: %{name}-client = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} + +%description extras +MySQL additional utilities except Perl scripts (they may be found in +%{name}-extras-perl package). + +%description extras -l pl.UTF-8 +Dodatkowe narzędzia do MySQL - z wyjątkiem skryptów Perla (które są w +pakiecie %{name}-extras-perl). + +%package extras-perl +Summary: MySQL additional utilities written in Perl +Summary(pl.UTF-8): Dodatkowe narzędzia do MySQL napisane w Perlu +Group: Applications/Databases +Requires: %{name}-extras = %{version}-%{release} +# this is just for the sake of smooth upgrade, not to break systems +Requires: mysqlhotcopy = %{version}-%{release} +Requires: perl(DBD::mysql) + +%description extras-perl +MySQL additional utilities written in Perl. + +%description extras-perl -l pl.UTF-8 +Dodatkowe narzędzia do MySQL napisane w Perlu. + +%package client +Summary: MySQL - Client +Summary(pl.UTF-8): MySQL - Klient +Summary(pt.UTF-8): MySQL - Cliente +Summary(ru.UTF-8): MySQL клиент +Summary(uk.UTF-8): MySQL клієнт +Group: Applications/Databases +Requires: %{name}-charsets = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} +Obsoletes: MySQL-client + +%description client +This package contains the standard MySQL clients. + +%description client -l fr.UTF-8 +Ce package contient les clients MySQL standards. + +%description client -l pl.UTF-8 +Standardowe programy klienckie MySQL. + +%description client -l pt_BR.UTF-8 +Este pacote contém os clientes padrão para o MySQL. + +%description client -l ru.UTF-8 +Этот пакет содержит только клиент MySQL. + +%description client -l uk.UTF-8 +Цей пакет містить тільки клієнта MySQL. + +%package libs +Summary: Shared libraries for MySQL +Summary(pl.UTF-8): Biblioteki współdzielone MySQL +Group: Libraries +Obsoletes: libmysql10 +Obsoletes: mysql-doc < 4.1.12 + +%description libs +Shared libraries for MySQL. + +%description libs -l pl.UTF-8 +Biblioteki współdzielone MySQL. + +%package devel +Summary: MySQL - development header files and other files +Summary(pl.UTF-8): MySQL - Pliki nagłówkowe i inne dla programistów +Summary(pt.UTF-8): MySQL - Medições de desempenho +Summary(ru.UTF-8): MySQL - хедеры и библиотеки разработчика +Summary(uk.UTF-8): MySQL - хедери та бібліотеки програміста +Group: Development/Libraries +Requires: %{name}-libs = %{version}-%{release} +%{?with_ssl:Requires: openssl-devel} +Requires: zlib-devel +Obsoletes: MySQL-devel +Obsoletes: libmysql10-devel + +%description devel +This package contains the development header files and other files +necessary to develop MySQL client applications. + +%description devel -l fr.UTF-8 +Ce package contient les fichiers entetes et les librairies de +developpement necessaires pour developper des applications clientes +MySQL. + +%description devel -l pl.UTF-8 +Pliki nagłówkowe i inne pliki konieczne do kompilacji aplikacji +klienckich MySQL. + +%description devel -l pt_BR.UTF-8 +Este pacote contém os arquivos de cabeçalho (header files) e +bibliotecas necessárias para desenvolver aplicações clientes do MySQL. + +%description devel -l ru.UTF-8 +Этот пакет содержит хедеры и библиотеки разработчика, необходимые для +разработки клиентских приложений. + +%description devel -l uk.UTF-8 +Цей пакет містить хедери та бібліотеки програміста, необхідні для +розробки програм-клієнтів. + +%package static +Summary: MySQL static libraries +Summary(pl.UTF-8): Biblioteki statyczne MySQL +Summary(ru.UTF-8): MySQL - статические библиотеки +Summary(uk.UTF-8): MySQL - статичні бібліотеки +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} +Obsoletes: MySQL-static + +%description static +MySQL static libraries. + +%description static -l pl.UTF-8 +Biblioteki statyczne MySQL. + +%description static -l ru.UTF-8 +Этот пакет содержит статические библиотеки разработчика, необходимые +для разработки клиентских приложений. + +%description static -l uk.UTF-8 +Цей пакет містить статичні бібліотеки програміста, необхідні для +розробки програм-клієнтів. + +%package bench +Summary: MySQL - Benchmarks +Summary(pl.UTF-8): MySQL - Programy testujące szybkość działania bazy +Summary(pt.UTF-8): MySQL - Medições de desempenho +Summary(ru.UTF-8): MySQL - бенчмарки +Summary(uk.UTF-8): MySQL - бенчмарки +Group: Applications/Databases +Requires: %{name} = %{version}-%{release} +Requires: %{name}-client +Requires: perl(DBD::mysql) +Obsoletes: MySQL-bench + +%description bench +This package contains MySQL benchmark scripts and data. + +%description bench -l pl.UTF-8 +Programy testujące szybkość serwera MySQL. + +%description bench -l pt_BR.UTF-8 +Este pacote contém medições de desempenho de scripts e dados do MySQL. + +%description bench -l ru.UTF-8 +Этот пакет содержит скрипты и данные для оценки производительности +MySQL. + +%description bench -l uk.UTF-8 +Цей пакет містить скрипти та дані для оцінки продуктивності MySQL. + +%package doc +Summary: MySQL manual +Summary(pl.UTF-8): Podręcznik użytkownika MySQL +Group: Applications/Databases + +%description doc +This package contains manual in HTML format. + +%description doc -l pl.UTF-8 +Podręcznik MySQL-a w formacie HTML. + +%package ndb +Summary: MySQL - NDB Storage Engine Daemon +Summary(pl.UTF-8): MySQL - demon silnika przechowywania danych NDB +Group: Applications/Databases +Requires: %{name}-libs = %{version}-%{release} + +%description ndb +This package contains the standard MySQL NDB Storage Engine Daemon. + +%description ndb -l pl.UTF-8 +Ten pakiet zawiera standardowego demona silnika przechowywania danych +NDB. + +%package ndb-client +Summary: MySQL - NDB Clients +Summary(pl.UTF-8): MySQL - programy klienckie NDB +Group: Applications/Databases +Requires: %{name}-libs = %{version}-%{release} + +%description ndb-client +This package contains the standard MySQL NDB Clients. + +%description ndb-client -l pl.UTF-8 +Ten pakiet zawiera standardowe programy klienckie MySQL NDB. + +%package ndb-mgm +Summary: MySQL - NDB Management Daemon +Summary(pl.UTF-8): MySQL - demon zarządzający NDB +Group: Applications/Databases +Requires: %{name}-libs = %{version}-%{release} + +%description ndb-mgm +This package contains the standard MySQL NDB Management Daemon. + +%description ndb-mgm -l pl.UTF-8 +Ten pakiet zawiera standardowego demona zarządzającego MySQL NDB. + +%package ndb-cpc +Summary: MySQL - NDB CPC Daemon +Summary(pl.UTF-8): MySQL - demon NDB CPC +Group: Applications/Databases +Requires: %{name}-libs = %{version}-%{release} + +%description ndb-cpc +This package contains the standard MySQL NDB CPC Daemon. + +%description ndb-cpc -l pl.UTF-8 +Ten pakiet zawiera standardowego demona MySQL NDB CPC. + +%prep +%setup -q -n Percona-Server-%{version}-rel%{percona_rel} %{?with_sphinx:-a100} +%if %{with sphinx} +# http://www.sphinxsearch.com/docs/manual-0.9.9.html#sphinxse-mysql51 +mv sphinx-*/mysqlse storage/sphinx +%patch18 -p1 +%endif +%patch0 -p1 +%patch2 -p1 +%patch3 -p1 + +%patch6 -p1 + +%patch9 -p1 +%patch11 -p1 +%patch12 -p1 +%patch14 -p0 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 + +# to get these files rebuild +[ -f sql/sql_yacc.cc ] && rm sql/sql_yacc.cc +[ -f sql/sql_yacc.h ] && rm sql/sql_yacc.h + +%build +install -d build +cd build +# NOTE that /var/lib/mysql/mysql.sock is symlink to real sock file +# (it defaults to first cluster but user may change it to whatever +# cluster it wants) + +%if "%{pld_release}" == "ac" +# add suffix, but allow ccache, etc in ~/.rpmmacros +%{expand:%%define __cc %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')} +%{expand:%%define __cxx %(echo '%__cxx' | sed -e 's,-g++,-g++4,')} +%{expand:%%define __cpp %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')} +%endif + +# upstream has fallen down badly on symbol versioning, do it ourselves +install -d libmysql +cp -a %{SOURCE15} libmysql/libmysql.version + +%cmake \ + -DCMAKE_BUILD_TYPE=%{!?debug:RelWithDebInfo}%{?debug:Debug} \ + -DCMAKE_C_FLAGS_RELEASE="%{rpmcflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \ + -DCMAKE_CXX_FLAGS_RELEASE="%{rpmcxxflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \ + -DCOMPILATION_COMMENT="PLD/Linux Distribution MySQL RPM" \ + -DCURSES_INCLUDE_PATH=/usr/include/ncurses \ + %{!?with_systemtap:-DENABLE_DTRACE=OFF} \ + -DFEATURE_SET="community" \ + -DINSTALL_LAYOUT=RPM \ + -DINSTALL_LIBDIR=%{_lib} \ + -DINSTALL_MYSQLTESTDIR_RPM="" \ + -DINSTALL_PLUGINDIR=%{_libdir}/%{name}/plugin \ + -DINSTALL_SQLBENCHDIR=%{_datadir} \ + -DINSTALL_SUPPORTFILESDIR=%{_datadir}/%{name}-support \ + -DMYSQL_UNIX_ADDR=/var/lib/%{name}/%{name}.sock \ + %{?debug:-DWITH_DEBUG=ON} \ + -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ + -DWITH_FAST_MUTEXES=ON \ + -DWITH_LIBEDIT=OFF \ + -DWITH_LIBWRAP=%{?with_tcpd:ON}%{!?with_tcpd:OFF} \ + -DWITH_PAM=ON \ + -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ + -DWITH_PIC=ON \ + -DWITH_READLINE=OFF \ +%if "%{pld_release}" == "ac" + -DWITH_SSL=%{?with_ssl:bundled}%{!?with_ssl:no} \ +%else + -DWITH_SSL=%{?with_ssl:system}%{!?with_ssl:no} \ +%endif + -DWITH_UNIT_TESTS=%{?with_tests:ON}%{!?with_tests:OFF} \ + -DWITH_ZLIB=system \ + .. + +%{__make} + +%{?with_tests:%{__make} test} + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mysql,skel} \ + $RPM_BUILD_ROOT/var/{log/{archive,}/mysql,lib/mysql} \ + $RPM_BUILD_ROOT%{_mysqlhome} \ + $RPM_BUILD_ROOT%{_libdir} + +%{__make} -C build install \ + DESTDIR=$RPM_BUILD_ROOT + +install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysql +cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/mysql +cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/mysql +# This is template for configuration file which is created after 'service mysql init' +cp -a %{SOURCE4} mysqld.conf +cp -a %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/clusters.conf +touch $RPM_BUILD_ROOT/var/log/%{name}/{mysqld,query,slow}.log + +# remove innodb directives from mysqld.conf if mysqld is configured without +%if %{without innodb} + cp mysqld.conf mysqld.tmp + awk 'BEGIN { RS="\n\n" } !/innodb/ { printf("%s\n\n", $0) }' < mysqld.tmp > mysqld.conf +%endif + +# remove berkeley-db directives from mysqld.conf if mysqld is configured without +cp mysqld.conf mysqld.tmp +awk 'BEGIN { RS="\n\n" } !/bdb/ { printf("%s\n\n", $0) }' < mysqld.tmp > mysqld.conf + +cp -a mysqld.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/mysqld.conf +cp -a %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/mysql-client.conf +ln -s mysql-client.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/my.cnf +cp -a %{SOURCE14} $RPM_BUILD_ROOT/etc/skel/.my.cnf + +# NDB +%if %{with ndb} +install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysql-ndb +cp -a %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/mysql-ndb +install -p %{SOURCE9} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysql-ndb-mgm +cp -a %{SOURCE10} $RPM_BUILD_ROOT/etc/sysconfig/mysql-ndb-mgm +install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysql-ndb-cpc +cp -a %{SOURCE12} $RPM_BUILD_ROOT/etc/sysconfig/mysql-ndb-cpc +%endif + +# symlinks point to the .so file, fix it +ln -sf libmysqlclient.so.18 $RPM_BUILD_ROOT%{_libdir}/libmysqlclient_r.so.18 +ln -sf libmysqlclient.so.18.0.0 $RPM_BUILD_ROOT%{_libdir}/libmysqlclient_r.so.18.0.0 + +sed -i -e 's,/usr//usr,%{_prefix},g' $RPM_BUILD_ROOT%{_bindir}/mysql_config +sed -i -e '/libs/s/$ldflags//' $RPM_BUILD_ROOT%{_bindir}/mysql_config +sed -i -e '/libs/s/-lprobes_mysql//' $RPM_BUILD_ROOT%{_bindir}/mysql_config + +# remove known unpackaged files +%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/mysql-support + +# rename not to be so generic name +mv $RPM_BUILD_ROOT%{_bindir}/{,mysql_}resolve_stack_dump +mv $RPM_BUILD_ROOT%{_mandir}/man1/{,mysql_}resolve_stack_dump.1 + +# move to _sysconfdir +mv $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}}/mysqlaccess.conf + +# not useful without -debug build +%{!?debug:%{__rm} $RPM_BUILD_ROOT%{_bindir}/mysql_resolve_stack_dump} +%{!?debug:%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql_resolve_stack_dump.1} +# generate symbols file, so one can generate backtrace using it +# mysql_resolve_stack_dump -s %{_datadir}/%{name}/mysqld.sym -n mysqld.stack. +# http://dev.mysql.com/doc/refman/5.0/en/using-stack-trace.html +%{?debug:nm -n $RPM_BUILD_ROOT%{_sbindir}/mysqld > $RPM_BUILD_ROOT%{_datadir}/%{name}/mysqld.sym} + +# do not clobber users $PATH +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/mysql_plugin +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/mysql_upgrade +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/innochecksum +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/myisamchk +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/myisamlog +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/myisampack +#mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/mysql_fix_privilege_tables +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/my_print_defaults +sed -i -e 's#/usr/bin/my_print_defaults#%{_sbindir}/my_print_defaults#g' $RPM_BUILD_ROOT%{_bindir}/mysql_install_db +mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/mysqlcheck + +# delete - functionality in initscript / rpm +# note: mysql_install_db (and thus resolveip) are needed by digikam +%{__rm} $RPM_BUILD_ROOT%{_bindir}/mysqld_safe +%{__rm} $RPM_BUILD_ROOT%{_bindir}/mysqld_multi +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysqld_{multi,safe}* +#rm $RPM_BUILD_ROOT%{_datadir}/%{name}/mysql-log-rotate +#rm $RPM_BUILD_ROOT%{_datadir}/%{name}/mysql.server +#rm $RPM_BUILD_ROOT%{_datadir}/%{name}/binary-configure +%{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/errmsg-utf8.txt +%{__rm} $RPM_BUILD_ROOT%{_bindir}/mysql_waitpid +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql_waitpid.1* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql.server* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysqlman.1* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/comp_err.1* + +# we don't package those (we have no -test or -testsuite pkg) and some of them just segfault +%{__rm} $RPM_BUILD_ROOT%{_bindir}/mysql_client_test +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql_client_test.1* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql_client_test_embedded.1* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql-stress-test.pl.1* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/mysql-test-run.pl.1* +%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/mysql-test + +# not needed +%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/plugin/libdaemon_example.* +%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/plugin/daemon_example.ini + +# not an .info file +%{__rm} $RPM_BUILD_ROOT%{_infodir}/mysql.info + +%clean +rm -rf $RPM_BUILD_ROOT + +%pre +%groupadd -g 89 mysql +%useradd -u 89 -d %{_mysqlhome} -s /bin/sh -g mysql -c "MySQL Server" mysql + +%post +/sbin/ldconfig +/sbin/chkconfig --add mysql +%service mysql restart + +%preun +if [ "$1" = "0" ]; then + %service -q mysql stop + /sbin/chkconfig --del mysql +fi + +%postun +/sbin/ldconfig +if [ "$1" = "0" ]; then + %userremove mysql + %groupremove mysql +fi + +%post ndb +/sbin/chkconfig --add mysql-ndb +%service mysql-ndb restart "mysql NDB engine" + +%preun ndb +if [ "$1" = "0" ]; then + %service mysql-ndb stop + /sbin/chkconfig --del mysql-ndb +fi + +%post ndb-mgm +/sbin/chkconfig --add mysql-ndb-mgm +%service mysql-ndb-mgm restart "mysql NDB management node" + +%preun ndb-mgm +if [ "$1" = "0" ]; then + %service mysql-ndb-mgm stop + /sbin/chkconfig --del mysql-ndb-mgm +fi + +%post ndb-cpc +/sbin/chkconfig --add mysql-ndb-cpc +%service mysql-ndb-cpc restart "mysql NDB CPC" + +%preun ndb-cpc +if [ "$1" = "0" ]; then + %service mysql-ndb-cpc stop + /sbin/chkconfig --del mysql-ndb-cpc +fi + +%post libs -p /sbin/ldconfig +%postun libs -p /sbin/ldconfig + +%triggerpostun -- mysql < 4.0.20-2.4 +# For clusters in /etc/%{name}/clusters.conf +if [ -f /etc/sysconfig/mysql ]; then + . /etc/sysconfig/mysql + if [ -n "$MYSQL_DB_CLUSTERS" ]; then + for i in "$MYSQL_DB_CLUSTERS"; do + echo "$i/mysqld.conf=$i" >> /etc/%{name}/clusters.conf + done + echo "# Do not use **obsolete** option MYSQL_DB_CLUSTERS" >> /etc/sysconfig/mysql + echo "# USE /etc/%{name}/clusters.conf instead" >> /etc/sysconfig/mysql + echo "Converted clusters from MYSQL_DB_CLUSTERS to /etc/%{name}/clusters.conf." + echo "You NEED to fix your /etc/sysconfig/mysql and verify /etc/%{name}/clusters.conf." + fi +fi + +%triggerpostun -- mysql < 4.1.1 +# For better compatibility with prevoius versions: +for config in $(awk -F= '!/^#/ && /=/{print $1}' /etc/%{name}/clusters.conf); do + if echo "$config" | grep -q '^/'; then + config_file="$config" + elif [ -f "/etc/%{name}/$config" ]; then + config_file=/etc/%{name}/$config + else + clusterdir=$(awk -F= "/^$config/{print \$2}" /etc/%{name}/clusters.conf) + if [ -z "$clusterdir" ]; then + echo >&2 "Can't find cluster dir for $config!" + echo >&2 "Please remove extra (leading) spaces from /etc/%{name}/clusters.conf" + exit 1 + fi + config_file="$clusterdir/mysqld.conf" + fi + + if [ ! -f "$config_file" ]; then + echo >&2 "Lost myself! Please report this (with above errors, if any) to http://bugs.pld-linux.org/" + exit 1 + fi + echo "Adding option old-passwords to config: $config_file" + echo "If you want to use new, better passwords - remove it" + + # sed magic to add 'old-passwords' to [mysqld] section + sed -i -e '/./{H;$!d;};x;/\[mysqld\]/{ + a + a; Compatibility options: + aold-passwords + } + ' $config_file +done + +%banner -e %{name}-4.1.x <<-EOF + If you want to use new help tables in MySQL 4.1.x then You'll need to import the help data: + mysql -u mysql mysql < %{_datadir}/%{name}/fill_help_tables.sql +EOF +#' + +%triggerpostun -- mysql < 5.1.0 +configs="" +for config in $(awk -F= '!/^#/ && /=/{print $1}' /etc/%{name}/clusters.conf); do + if echo "$config" | grep -q '^/'; then + config_file="$config" + elif [ -f "/etc/%{name}/$config" ]; then + config_file=/etc/%{name}/$config + else + clusterdir=$(awk -F= "/^$config/{print \$2}" /etc/%{name}/clusters.conf) + if [ -z "$clusterdir" ]; then + echo >&2 "Can't find cluster dir for $config!" + echo >&2 "Please remove extra (leading) spaces from /etc/%{name}/clusters.conf" + exit 1 + fi + config_file="$clusterdir/mysqld.conf" + fi + + if [ ! -f "$config_file" ]; then + echo >&2 "ERROR: Can't find real config file for $config! Please report this (with above errors, if any) to http://bugs.pld-linux.org/" + continue + fi + configs="$configs $config_file" +done + +( +echo 'You should run MySQL upgrade script *after* restarting MySQL server for all MySQL clusters.' +echo 'Thus, you should invoke:' +for config in $configs; do + sed -i -e ' + s/set-variable\s*=\s* // + # use # as comment in config + s/^;/#/ + ' $config + + datadir=$(awk -F= '!/^#/ && $1 ~ /datadir/{print $2}' $config | xargs) + echo "# mysql_upgrade --datadir=$datadir" +done +) | %banner -e %{name}-5.1 + +%triggerpostun -- mysql < 5.5.0 +configs="" +for config in $(awk -F= '!/^#/ && /=/{print $1}' /etc/%{name}/clusters.conf); do + if echo "$config" | grep -q '^/'; then + config_file="$config" + elif [ -f "/etc/%{name}/$config" ]; then + config_file=/etc/%{name}/$config + else + clusterdir=$(awk -F= "/^$config/{print \$2}" /etc/%{name}/clusters.conf) + if [ -z "$clusterdir" ]; then + echo >&2 "Can't find cluster dir for $config!" + echo >&2 "Please remove extra (leading) spaces from /etc/%{name}/clusters.conf" + exit 1 + fi + config_file="$clusterdir/mysqld.conf" + fi + + if [ ! -f "$config_file" ]; then + echo >&2 "ERROR: Can't find real config file for $config! Please report this (with above errors, if any) to http://bugs.pld-linux.org/" + continue + fi + configs="$configs $config_file" +done + +( +echo 'You should run MySQL upgrade script *after* restarting MySQL server for all MySQL clusters.' +echo 'Thus, you should invoke:' +for config in $configs; do + sed -i -e ' + s/^language *= *polish/lc-messages = pl_PL/i + s/set-variable\s*=\s* // + s/^skip-locking/skip-external-locking/ + # this is not valid for server. it is client option + s/^default-character-set/# client-config: &/ + # use # as comment in config + s/^;/#/ + ' $config + + socket=$(awk -F= '!/^#/ && $1 ~ /socket/{print $2}' $config | xargs) + echo "# mysql_upgrade ${socket:+--socket=$socket}" +done +) | %banner -e %{name}-5.5 + +%files +%defattr(644,root,root,755) +%doc build/support-files/*.cnf build/support-files/*.ini +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} +%attr(754,root,root) /etc/rc.d/init.d/%{name} +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} +%attr(640,root,mysql) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/clusters.conf +%attr(755,root,root) %{_sbindir}/innochecksum +%attr(755,root,root) %{_sbindir}/my_print_defaults +%attr(755,root,root) %{_sbindir}/myisamchk +%attr(755,root,root) %{_sbindir}/myisamlog +%attr(755,root,root) %{_sbindir}/myisampack +#%attr(755,root,root) %{_sbindir}/mysql_fix_privilege_tables +%attr(755,root,root) %{_sbindir}/mysql_plugin +%attr(755,root,root) %{_sbindir}/mysql_upgrade +%attr(755,root,root) %{_sbindir}/mysqlcheck +%attr(755,root,root) %{_sbindir}/mysqld +%dir %{_libdir}/%{name} +%dir %{_libdir}/%{name}/plugin +%attr(755,root,root) %{_libdir}/%{name}/plugin/adt_null.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/auth.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/auth_pam.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/auth_pam_compat.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/auth_socket.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/auth_test_plugin.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/dialog.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/ha_archive.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/ha_blackhole.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/ha_federated.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/mypluglib.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/qa_auth_client.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/qa_auth_interface.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/qa_auth_server.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/semisync_master.so +%attr(755,root,root) %{_libdir}/%{name}/plugin/semisync_slave.so +%if %{with sphinx} +%attr(755,root,root) %{_libdir}/%{name}/plugin/ha_sphinx.so +%endif +# for plugins +%attr(755,root,root) %{_libdir}/libmysqlservices.so +%{_mandir}/man1/innochecksum.1* +%{_mandir}/man1/my_print_defaults.1* +%{_mandir}/man1/myisamchk.1* +%{_mandir}/man1/myisamlog.1* +%{_mandir}/man1/myisampack.1* +#%{_mandir}/man1/mysql_fix_privilege_tables.1* +%{_mandir}/man1/mysql_plugin.1* +%{_mandir}/man1/mysql_upgrade.1* +%{_mandir}/man1/mysqlcheck.1* +%{_mandir}/man8/mysqld.8* + +%if %{?debug:1}0 +%attr(755,root,root) %{_bindir}/*resolve_stack_dump +%{_datadir}/%{name}/mysqld.sym +%{_mandir}/man1/*resolve_stack_dump.1* +%endif + +%attr(700,mysql,mysql) %{_mysqlhome} +# root:root is proper here for mysql.rpm while mysql:mysql is potential security hole +%attr(751,root,root) /var/lib/mysql +%attr(750,mysql,mysql) %dir /var/log/mysql +%attr(750,mysql,mysql) %dir /var/log/archive/mysql +%attr(640,mysql,mysql) %ghost /var/log/mysql/* + +# This is template for configuration file which is created after 'service mysql init' +%{_datadir}/%{name}/mysqld.conf +%{_datadir}/%{name}/mysql_system_tables.sql +%{_datadir}/%{name}/mysql_system_tables_data.sql +%{_datadir}/%{name}/mysql_test_data_timezone.sql + +%{_datadir}/%{name}/english +%{_datadir}/%{name}/fill_help_tables.sql +#%{_datadir}/%{name}/mysql_fix_privilege_tables.sql +%lang(cs) %{_datadir}/%{name}/czech +%lang(da) %{_datadir}/%{name}/danish +%lang(de) %{_datadir}/%{name}/german +%lang(el) %{_datadir}/%{name}/greek +%lang(es) %{_datadir}/%{name}/spanish +%lang(et) %{_datadir}/%{name}/estonian +%lang(fr) %{_datadir}/%{name}/french +%lang(hu) %{_datadir}/%{name}/hungarian +%lang(it) %{_datadir}/%{name}/italian +%lang(ja) %{_datadir}/%{name}/japanese +%lang(ko) %{_datadir}/%{name}/korean +%lang(nl) %{_datadir}/%{name}/dutch +%lang(nb) %{_datadir}/%{name}/norwegian +%lang(nn) %{_datadir}/%{name}/norwegian-ny +%lang(pl) %{_datadir}/%{name}/polish +%lang(pt) %{_datadir}/%{name}/portuguese +%lang(ro) %{_datadir}/%{name}/romanian +%lang(ru) %{_datadir}/%{name}/russian +%lang(sr) %{_datadir}/%{name}/serbian +%lang(sk) %{_datadir}/%{name}/slovak +%lang(sv) %{_datadir}/%{name}/swedish +%lang(uk) %{_datadir}/%{name}/ukrainian + +%files charsets +%defattr(644,root,root,755) +%dir %{_datadir}/mysql +%{_datadir}/%{name}/charsets + +%files extras +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/msql2mysql +%attr(755,root,root) %{_bindir}/myisam_ftdump +%attr(755,root,root) %{_bindir}/mysql_install_db +%attr(755,root,root) %{_bindir}/mysql_secure_installation +%attr(755,root,root) %{_bindir}/mysql_tzinfo_to_sql +%attr(755,root,root) %{_bindir}/perror +%attr(755,root,root) %{_bindir}/replace +%attr(755,root,root) %{_bindir}/resolveip +%{_mandir}/man1/msql2mysql.1* +%{_mandir}/man1/myisam_ftdump.1* +%{_mandir}/man1/mysql_install_db.1* +%{_mandir}/man1/mysql_secure_installation.1* +%{_mandir}/man1/mysql_tzinfo_to_sql.1* +%{_mandir}/man1/perror.1* +%{_mandir}/man1/replace.1* +%{_mandir}/man1/resolveip.1* + +%files -n mysqlhotcopy +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/mysqlhotcopy +%{_mandir}/man1/mysqlhotcopy.1* + +%files extras-perl +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/mysql_convert_table_format +%attr(755,root,root) %{_bindir}/mysql_find_rows +%attr(755,root,root) %{_bindir}/mysql_fix_extensions +%attr(755,root,root) %{_bindir}/mysql_setpermission +%attr(755,root,root) %{_bindir}/mysql_zap +%attr(755,root,root) %{_bindir}/mysqlaccess +%attr(755,root,root) %{_bindir}/mysqldumpslow +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mysqlaccess.conf +%{_mandir}/man1/mysql_convert_table_format.1* +%{_mandir}/man1/mysql_find_rows.1* +%{_mandir}/man1/mysql_fix_extensions.1* +%{_mandir}/man1/mysql_setpermission.1* +%{_mandir}/man1/mysql_zap.1* +%{_mandir}/man1/mysqlaccess.1* +%{_mandir}/man1/mysqldumpslow.1* + +%files client +%defattr(644,root,root,755) +%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/skel/.my.cnf +%attr(755,root,root) %{_bindir}/mysql +%attr(755,root,root) %{_bindir}/mysqladmin +%attr(755,root,root) %{_bindir}/mysqlbinlog +%attr(755,root,root) %{_bindir}/mysqlbug +%attr(755,root,root) %{_bindir}/mysqldump +%attr(755,root,root) %{_bindir}/mysqlimport +%attr(755,root,root) %{_bindir}/mysqlshow +%{_mandir}/man1/mysql.1* +%{_mandir}/man1/mysqladmin.1* +%{_mandir}/man1/mysqlbinlog.1* +%{_mandir}/man1/mysqlbug.1* +%{_mandir}/man1/mysqldump.1* +%{_mandir}/man1/mysqlimport.1* +%{_mandir}/man1/mysqlshow.1* + +%files libs +%defattr(644,root,root,755) +%attr(751,root,root) %dir %{_sysconfdir}/mysql +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/mysql-client.conf +%{_sysconfdir}/%{name}/my.cnf +%attr(755,root,root) %{_libdir}/libmysqlclient.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libmysqlclient.so.18 +%attr(755,root,root) %{_libdir}/libmysqlclient_r.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libmysqlclient_r.so.18 +%if %{with ndb} +%attr(755,root,root) %{_libdir}/libndbclient.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libndbclient.so.3 +%endif + +%files devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/mysql_config +%attr(755,root,root) %{_libdir}/libmysqlclient.so +%attr(755,root,root) %{_libdir}/libmysqlclient_r.so +%if %{with ndb} +%attr(755,root,root) %{_libdir}/libndbclient.so +%endif +%{_includedir}/mysql +%{_aclocaldir}/mysql.m4 +%{_mandir}/man1/mysql_config.1* + +%files static +%defattr(644,root,root,755) +%{_libdir}/libmysqlclient.a +%{_libdir}/libmysqlclient_r.a +%if %{with ndb} +%{_libdir}/libndbclient.a +%endif + +%files bench +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/mysqlslap +%attr(755,root,root) %{_bindir}/mysqltest +%dir %{_datadir}/sql-bench +%{_datadir}/sql-bench/[CDRl]* +%attr(755,root,root) %{_datadir}/sql-bench/[bcgirst]* +%{_mandir}/man1/mysqlslap.1* +%{_mandir}/man1/mysqltest.1* +%{_mandir}/man1/mysqltest_embedded.1* + +#%files doc +#%defattr(644,root,root,755) +#%doc Docs/manual.html Docs/manual_toc.html + +%if %{with ndb} +%files ndb +%defattr(644,root,root,755) +%attr(755,root,root) %{_sbindir}/ndbd +%attr(754,root,root) /etc/rc.d/init.d/mysql-ndb +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mysql-ndb +%{_mandir}/man1/ndbd_redo_log_reader.1* +%{_mandir}/man8/ndbd.8* + +%files ndb-client +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/ndb_config +%attr(755,root,root) %{_bindir}/ndb_delete_all +%attr(755,root,root) %{_bindir}/ndb_desc +%attr(755,root,root) %{_bindir}/ndb_drop_index +%attr(755,root,root) %{_bindir}/ndb_drop_table +%attr(755,root,root) %{_bindir}/ndb_error_reporter +%attr(755,root,root) %{_bindir}/ndb_mgm +%attr(755,root,root) %{_bindir}/ndb_print_backup_file +%attr(755,root,root) %{_bindir}/ndb_print_schema_file +%attr(755,root,root) %{_bindir}/ndb_print_sys_file +%attr(755,root,root) %{_bindir}/ndb_restore +%attr(755,root,root) %{_bindir}/ndb_select_all +%attr(755,root,root) %{_bindir}/ndb_select_count +%attr(755,root,root) %{_bindir}/ndb_show_tables +%attr(755,root,root) %{_bindir}/ndb_size.pl +%attr(755,root,root) %{_bindir}/ndb_test_platform +%attr(755,root,root) %{_bindir}/ndb_waiter +%{_mandir}/man1/ndb_config.1* +%{_mandir}/man1/ndb_delete_all.1* +%{_mandir}/man1/ndb_desc.1* +%{_mandir}/man1/ndb_drop_index.1* +%{_mandir}/man1/ndb_drop_table.1* +%{_mandir}/man1/ndb_error_reporter.1* +%{_mandir}/man1/ndb_mgm.1* +%{_mandir}/man1/ndb_print_backup_file.1* +%{_mandir}/man1/ndb_print_schema_file.1* +%{_mandir}/man1/ndb_print_sys_file.1* +%{_mandir}/man1/ndb_restore.1* +%{_mandir}/man1/ndb_select_all.1* +%{_mandir}/man1/ndb_select_count.1* +%{_mandir}/man1/ndb_show_tables.1* +%{_mandir}/man1/ndb_size.pl.1* +%{_mandir}/man1/ndb_waiter.1* + +%files ndb-mgm +%defattr(644,root,root,755) +%attr(755,root,root) %{_sbindir}/ndb_mgmd +%attr(754,root,root) /etc/rc.d/init.d/mysql-ndb-mgm +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mysql-ndb-mgm +%{_mandir}/man8/ndb_mgmd.8* + +%files ndb-cpc +%defattr(644,root,root,755) +%attr(755,root,root) %{_sbindir}/ndb_cpcd +%attr(754,root,root) /etc/rc.d/init.d/mysql-ndb-cpc +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mysql-ndb-cpc +%{_mandir}/man1/ndb_cpcd.1* +%endif diff --git a/mysql.sysconfig b/mysql.sysconfig new file mode 100644 index 0000000..a314c78 --- /dev/null +++ b/mysql.sysconfig @@ -0,0 +1,27 @@ +# Customized settings for mysql + +# Define nice level for mysql +SERVICE_RUN_NICE_LEVEL="+0" + +# Be compatible with RA layout (not supported) +MYSQL_RA_COMPAT="no" + +# For clusters configuration look into /etc/mysql/clusters.conf +# Don't use **obsolete** MYSQL_DB_CLUSTERS option + +# Seconds to wait for fully initialized mysqld to start. mysqld takes longer to +# start when it has to replay innodb logs, or create innodb pools at startup +#MYSQL_START_WAIT_TIME=15 + +# Seconds to wait for mysqld to terminate on shutdown. If timeout is exceeded +# shutdown is considered failed +#MYSQL_STOP_WAIT_TIME=900 + +# Skip automatic mysqld restarts invoked from rpm installs. +#RPM_SKIP_AUTO_RESTART=yes + +# Any option passed directly to mysqld on startup. +#MYSQL_OPTIONS="--open-files-limit=65535" + +# fd limit increase +#SERVICE_LIMITS="$DEFAULT_SERVICE_LIMITS -n 65535" diff --git a/mysqld.conf b/mysqld.conf new file mode 100644 index 0000000..c4f7331 --- /dev/null +++ b/mysqld.conf @@ -0,0 +1,229 @@ +# The MySQL server configuration file. +# vim:ft=mycnf +# +# One can use all long options that the mysqld supports. +# Run mysqld with --help to get a whole list of available options +# $Id$ + +# This section must be the first! +[mysqld] +datadir = @clusterdir@/mysqldb/db +pid-file = @clusterdir@/mysqldb/mysql.pid +socket = @clusterdir@/mysqldb/mysql.sock +port = 3306 +user = mysql + +# ssl options +#ssl-ca = /etc/ssl/certs/mysql/ca-cert.pem +#ssl-cert = /etc/ssl/certs/mysql/server-cert.pem +#ssl-key = /etc/ssl/certs/mysql/server-key.pem +#ssl-cipher = DHE-RSA-AES256-SHA + +#character-set-server=latin2 +#collation-server=latin2_general_ci +#skip-character-set-client-handshake + +# Use passwords compatible with old 4.0 mysqld +#old-passwords + +# Don't use system locking +skip-external-locking + +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 + +# Default storage engine is InnoDB since 5.5.5 +# You may revert to previous behaviour by specifiying MyISAM here +#default-storage-engine=InnoDB + +# Don't listen on a TCP/IP port at all. This is a security enhancement, +# if all processes that need to connect to mysqld run on the same host. +# All interaction with mysqld must be made via Unix sockets. +skip-networking + +# IP address to bind to +#bind-address=127.0.0.1 + +# no dns +#skip-name-resolve + +# Emergency option. Use only if you really need this. +#skip-grant-tables + +# http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_default-storage-engine +#default-storage-engine=MyISAM + +# Replication Master Server (default) +# binary logging is required for replication +#log-bin=mysql-bin + +# max size of master binlog files +#max_binlog_size=256M + +# If non-zero, binary logs will be purged after expire_logs_days days; possible +# purges happen at startup and at binary log rotation. +#expire-logs-days=30 + +# Normally, a slave does not log to its own binary log any updates that are +# received from a master server. This option tells the slave to log the updates +# performed by its SQL thread to its own binary log. For this option to have +# any effect, the slave must also be started with the --log-bin option to +# enable binary logging. --log-slave-updates is used when you want to chain +# replication servers. +#log-slave-updates + +# required unique id between 1 and 2^32 - 1 +# defaults to 1 if master-host is not set but will not function as a master if omitted +#server-id=2 + +# To set up N master servers, set the variables like this: +# Set auto_increment_increment to N on each master. +# Set each of the N masters to have a different auto_increment_offset, using the values 1, 2, ..., N +#auto-increment-offset=1 +#auto-increment-increment=2 + +# databases to be included in binlog +#binlog-do-db=db1 +# or excluded +#binlog-ignore-db=mysql +#binlog-ignore-db=test + +# slave setup +#relay-log=slave-relay-bin +#report-host=db-slave.example.org + +# skip startup of slave +#skip-slave-start + +# master does not ignore them, but we do +#replicate-ignore-db=mysql +#replicate-ignore-db=test +#replicate-ignore-table=db1.tbl1 +#replicate-ignore-table=db2.tbl2 + +#replicate-rewrite-db=delfi->delfi_ro + +# replication local log +#max_relay_log_size=256M + +# global option where logs be written +log-output = FILE + +# mysqld error log (stderr) +log-error = /var/log/mysql/mysqld.log +log-warnings = 2 + +# Log slow queries +slow-query-log +slow-query-log_file = /var/log/mysql/slow.log + +# Log connections and queries. It slows down MySQL so it's disabled by default +#general-log +#general-log-file = /var/log/mysql/query.log + +# Log all updates. +#log-update = /var/log/mysql/update +# Log some extra information to update log +#log-long-format + +# Language +#lc-messages = pl_PL + +# Path for temporary files. Several paths may be specified, separated by a +# colon (:), in this case they are used in a round-robin fashion. +#tmpdir = /var/tmp + +# +# Internal server variables +# + +#back_log=5 +#connect_timeout=5 +#delayed_insert_timeout=300 +#delayed_insert_limit=100 +#flush_time=0 +#join_buffer_size=131072 +#key_buffer_size=8M +#read_rnd_buffer_size=256K +#read_buffer_size=132K +#long_query_time=10 +#max_allowed_packet=1M +#max_connections=100 +#max_user_connections=0 +#max_connect_errors=10 +#max_delayed_threads=20 +#delayed_queue_size=1000 +#max_join_size=4294967295 +#max_sort_length=1024 +#max_write_lock_count=4294967295 +#net_buffer_length=16384 +#record_buffer=131072 +#sort_buffer_size=2M +#table_cache=64 +#tmp_table_size=1M +#max_heap_table_size=32M +#thread_cache_size=16 +#thread_stack=65536 +# Try number of CPU's*2 +#thread_concurrency=8 +#wait_timeout=28800 +#query_cache_size=8M +#query_cache_limit=1M + +# Fulltext search options +#ft_min_word_len=2 + +# +# MyISAM tables options +# + +# Don't flush key buffers between writes for any MyISAM +# set this if you have dedicated slave server where writes aren't important +#delay-key-write-for-all-tables + +# Repair automatically on open if the table wasn't closed properly. +myisam-recover +# +#myisam_sort_buffer_size=4M + + +# To completely disable InnoDB, use this option +# this makes all innodb options being unknown options (including skip-innodb) +# @deprecated +#ignore-builtin-innodb + +# +# InnoDB tables options (see MySQL manual) +# +#skip-innodb + +# http://stackoverflow.com/questions/2646373/mysql-data-file-wont-shrink +# http://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html +#innodb_file_per_table + +# these are actual defaults (as of 5.0.26) +innodb_data_home_dir = @clusterdir@/mysqldb/db +innodb_data_file_path = ibdata1:10M:autoextend +innodb_mirrored_log_groups=1 +innodb_log_group_home_dir = @clusterdir@/mysqldb/db +innodb_log_files_in_group=2 +innodb_log_file_size=5M +innodb_log_buffer_size=1M + +#innodb_flush_log_at_trx_commit=1 +#innodb_log_arch_dir = @clusterdir@/innodb/log +#innodb_log_archive=0 +#innodb_buffer_pool_size=80M +#innodb_additional_mem_pool_size=10M +#innodb_file_io_threads=4 +#innodb_lock_wait_timeout=50 + +# used for logs rotation +[mysqladmin] +user = mysql_sysadmin +password = + +# used by initscript to fetch slave status +[mysql] +user = mysql +password = diff --git a/mysqlhotcopy-5.0-5.5.patch b/mysqlhotcopy-5.0-5.5.patch new file mode 100644 index 0000000..3382da2 --- /dev/null +++ b/mysqlhotcopy-5.0-5.5.patch @@ -0,0 +1,11 @@ +--- ./scripts/mysqlhotcopy.sh~ 2013-03-19 11:30:02.000000000 +0200 ++++ ./scripts/mysqlhotcopy.sh 2013-05-10 00:42:25.986175909 +0300 +@@ -789,7 +789,7 @@ + + eval { + my ($file,$position) = get_row( $dbh, "show master status" ); +- die "master status is undefined" if !defined $file || !defined $position; ++ warn "master status is undefined" if !defined $file || !defined $position; + + my $row_hash = get_row_hash( $dbh, "show slave status" ); + my ($master_host, $log_file, $log_pos ); -- 2.46.0