From c8d45f00238c098b5c188d500203d0ecf21558e9 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sat, 30 Dec 2023 12:54:08 +0100 Subject: [PATCH] - paths fixes, init fixes, misc fixes, works, release 1 --- mysql-clusters.conf | 2 +- mysql.init | 142 ++++++++++++++++++++++---------------------- mysql.logrotate | 12 ++-- mysql.spec | 126 +++++++++++++++++++++++++-------------- mysqld.conf | 14 ++--- 5 files changed, 168 insertions(+), 128 deletions(-) diff --git a/mysql-clusters.conf b/mysql-clusters.conf index 02d9beb..1eb2b02 100644 --- a/mysql-clusters.conf +++ b/mysql-clusters.conf @@ -7,4 +7,4 @@ # /config/location.conf=/cluster/directory # If you give config name without path it defaults to /etc/mysql/ -mysqld.conf=/var/lib/mysql{MYSQL_MAJOR}/01 +mysqld.conf=/var/lib/mysql/@mysqlversion@/main diff --git a/mysql.init b/mysql.init index c0a7a26..1e8ff67 100755 --- a/mysql.init +++ b/mysql.init @@ -1,6 +1,6 @@ #!/bin/sh # -# mysql{MYSQL_MAJOR} A very fast and reliable SQL database engine +# mysql A very fast and reliable SQL database engine # # chkconfig: 2345 84 25 # @@ -13,30 +13,30 @@ . /etc/sysconfig/network # Get service config -if [ -f /etc/sysconfig/mysql{MYSQL_MAJOR} ]; then - . /etc/sysconfig/mysql{MYSQL_MAJOR} +if [ -f /etc/sysconfig/mysql-@mysqlversion@ ]; then + . /etc/sysconfig/mysql-@mysqlversion@ else - nls "Error: %s not found" /etc/sysconfig/mysql{MYSQL_MAJOR} - nls "%s can't be run." MySQL{MYSQL_MAJOR} + nls "Error: %s not found" /etc/sysconfig/mysql-@mysqlversion@ + 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{MYSQL_MAJOR}/clusters.conf + nls "Warning: MYSQL_DB_CLUSTERS is set. It's obsolete. Use %s instead." /etc/mysql/@mysqlversion@/clusters.conf fi -if [ -f /etc/mysql{MYSQL_MAJOR}/clusters.conf ]; then - MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/ && /=/{print $2}' /etc/mysql{MYSQL_MAJOR}/clusters.conf) +if [ -f /etc/mysql/@mysqlversion@/clusters.conf ]; then + MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/ && /=/{print $2}' /etc/mysql/@mysqlversion@/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{MYSQL_MAJOR}/clusters.conf + nls "Warning: Missing clusters config file %s" /etc/mysql/@mysqlversion@/clusters.conf if [ -z "$MYSQL_DB_CLUSTERS" ]; then nls "Warning: there are no configured clusters." - nls "Using default cluster /var/lib/mysql{MYSQL_MAJOR} (compatibility mode)" - MYSQL_DB_CLUSTERS=/var/lib/mysql{MYSQL_MAJOR}/01 + nls "Using default cluster /var/lib/mysql (compatibility mode)" + MYSQL_DB_CLUSTERS=/var/lib/mysql fi fi @@ -44,14 +44,14 @@ 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{MYSQL_MAJOR} + msg_network_down MySQL exit 1 fi else exit 0 fi -sharedir=/usr/share/mysql{MYSQL_MAJOR} +sharedir=/usr/share/mysql/@mysqlversion@ action="$1" @@ -60,9 +60,9 @@ if [ $# -gt 1 ]; then shift # perform action for specified clusters only for a in "$@"; do - # try auto resolving from /etc/mysql{MYSQL_MAJOR}/clusters.conf + # try auto resolving from /etc/mysql/@mysqlversion@/clusters.conf if [[ "$a" != /* ]]; then - m=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $1}' /etc/mysql{MYSQL_MAJOR}/clusters.conf) + m=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $1}' /etc/mysql/@mysqlversion@/clusters.conf) if [ -z "$m" ]; then echo >&2 "Cluster name '$a' did not match anything!" exit 1 @@ -71,7 +71,7 @@ if [ $# -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{MYSQL_MAJOR}/clusters.conf) + a=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $2}' /etc/mysql/@mysqlversion@/clusters.conf) fi DB_CLUSTERS="$DB_CLUSTERS $a" done @@ -80,7 +80,7 @@ else fi # global error log, if mysqld.conf hasn't migrated to log-error style -MYSQL_ERRLOG=/var/log/mysql{MYSQL_MAJOR}/mysqld.log +MYSQL_ERRLOG=/var/log/mysql/@mysqlversion@/mysql.log MYSQL_STOP_WAIT_TIME=${MYSQL_STOP_WAIT_TIME:-900} # @@ -125,7 +125,7 @@ mysqlstatus() { fi if [ "$mode" = "start" ]; then - MYSQL_GREP_PID=$(grep -alE "^/usr/sbin/mysqld{MYSQL_MAJOR}.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }') + MYSQL_GREP_PID=$(grep -alE "^@mysqlsbindir@/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 @@ -159,14 +159,14 @@ mysqlgetconfig() { local clusterdir="$1" config_file local mode="$2" - local config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mysql{MYSQL_MAJOR}/clusters.conf) - if [[ $config = /* ]]; then - config_file="$config" - elif [ -f "/etc/mysql{MYSQL_MAJOR}/$config" ]; then - config_file="/etc/mysql{MYSQL_MAJOR}/$config" - else - config_file="$clusterdir/mysqld.conf" - fi + local config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mysql/@mysqlversion@/clusters.conf) + if [[ $config = /* ]]; then + config_file="$config" + elif [ -f "/etc/mysql/@mysqlversion@/$config" ]; then + config_file="/etc/mysql/@mysqlversion@/$config" + else + config_file="$clusterdir/mysqld.conf" + fi MYSQL_CLUSTER_DIR="$clusterdir" @@ -183,7 +183,7 @@ mysqlgetconfig() { if [ ! -f "$config_file" ]; then nls "Error: config file %s not found" "$config_file" - nls "MySQL{MYSQL_MAJOR} can't be run. Did you initialize DB by doing \`$0 init'?" + nls "MySQL can't be run. Did you initialize DB by doing \`$0 init'?" if [ "$mode" = "status" ]; then exit 3 else @@ -257,7 +257,7 @@ mysqlgetconfig() { fi if [ -z "$MYSQL_USER" ]; then - echo "$(nls 'MySQL{MYSQL_MAJOR} user not configured properly')"'!' >&2 + echo "$(nls 'MySQL user not configured properly')"'!' >&2 nls "Edit %s and configure it." "$config_file" >&2 exit 6 fi @@ -268,18 +268,18 @@ mysqlstart() { local clusterdir="$1" mysqlgetconfig "$clusterdir" if [ ! -d "$MYSQL_DATA_DIR/mysql" ]; then - nls "MySQL{MYSQL_MAJOR} cluster %s not initialized." "$clusterdir" + nls "MySQL cluster %s not initialized." "$clusterdir" nls "Try \`%s init %s' before start." "$0" "$clusterdir" exit 6 fi - msg_starting "MySQL{MYSQL_MAJOR} $clusterdir"; busy + 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{MYSQL_MAJOR} \ + /usr/bin/setsid @mysqlsbindir@/mysqld \ --defaults-file=$MYSQL_CONFIG \ --datadir=$MYSQL_DATA_DIR \ --pid-file=$MYSQL_PIDFILE \ @@ -292,7 +292,7 @@ mysqlstart() { # 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{MYSQL_MAJOR} to start" + show "Waiting for MySQL to start" busy # while the pid is running, mysql is starting up @@ -326,7 +326,7 @@ mysqlstop() { # try graceful shutdown -- send shutdown command # requires mysql_sysadmin user proper privs - /usr/bin/mysqladmin{MYSQL_MAJOR} --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown >/dev/null 2>&1 + @mysqlbindir@/mysqladmin --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown >/dev/null 2>&1 mysqlstatus "$clusterdir" stop if [ "$MYSQL_PID" != "unknown" ]; then @@ -350,13 +350,13 @@ mysqlstop() { # report slave status # uses MYSQL_SOCKET - path to mysql socket slave_status() { - if [ ! -x /usr/bin/mysql{MYSQL_MAJOR} ]; then - echo >&2 "Slave status not available: 'mysql{MYSQL_MAJOR}' program not installed." + if [ ! -x @mysqlbindir@/mysql ]; then + echo >&2 "Slave status not available: 'mysql' program not installed." return fi # see if slave status can be reported - local err=0 slave_status=$(mysql{MYSQL_MAJOR} --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" -e 'show slave status\G') + 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 @@ -416,20 +416,26 @@ mysqlsubsys() { for mysqldir in $DB_CLUSTERS; do mysqlstatus "$mysqldir" if [ "$MYSQL_STATUS" = "running" ]; then - touch /var/lock/subsys/mysql{MYSQL_MAJOR} + touch /var/lock/subsys/mysql-@mysqlversion@ return fi done - rm -f /var/lock/subsys/mysql{MYSQL_MAJOR} + rm -f /var/lock/subsys/mysql-@mysqlversion@ } 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="root" + MYSQL_USER="mysql" MYSQL_CLUSTER_DIR="$clusterdir" MYSQL_DATA_DIR="$clusterdir/mysqldb/db" MYSQL_PIDFILE="$clusterdir/mysqldb/mysql.pid" @@ -449,7 +455,7 @@ mysqlinit() { exit 6 fi - show "Initializing MySQL{MYSQL_MAJOR} database for $MYSQL_DATA_DIR" + show "Initializing MySQL database for $MYSQL_DATA_DIR" busy TMP=/tmp TMPDIR=/tmp @@ -471,12 +477,13 @@ mysqlinit() { fi ok=0 - /usr/sbin/mysqld{MYSQL_MAJOR} \ + @mysqlsbindir@/mysqld \ --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \ - --initialize \ + --initialize-insecure \ --skip-grant-tables \ --datadir=$MYSQL_DATA_DIR \ --user=$MYSQL_USER \ + --replica-load-tmpdir=$MYSQL_DATA_DIR \ --tmpdir=$MYSQL_DATA_DIR \ --log-error=$MYSQL_ERRLOG \ && ok=1 @@ -486,10 +493,10 @@ mysqlinit() { ok cat << END_OF_MSG -PLEASE REMEMBER TO CHANGE A PASSWORD FOR THE MySQL{MYSQL_MAJOR} USERS! +PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL USERS! Start database: -$ service mysql{MYSQL_MAJOR} start +$ service mysql-@mysqlversion@ start and set passwords: @@ -504,15 +511,9 @@ FLUSH PRIVILEGES; Both into command: -$ mysql{MYSQL_MAJOR} -u root -p --ssl-mode=disabled -S $MYSQL_SOCKET - -NOTE 1: -CURRENT TEMPORARY ROOT PASSWORD CAN BE FOUND IN LOG -(grep for "A temporary password is generated" string): -$MYSQL_ERRLOG - +$ mysql -u root -p --ssl-mode=disabled -S $MYSQL_SOCKET -NOTE 2: +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) @@ -530,20 +531,21 @@ ERROR: Examine the logs in $MYSQL_ERRLOG for more information. You can also try to start the mysqld daemon with: -/usr/sbin/mysqld{MYSQL_MAJOR} --skip-grant & +@mysqlsbindir@/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{MYSQL_MAJOR} -u mysql mysql +shell> mysql -u root 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{MYSQL_MAJOR}/query.log that -may be helpful. The latest information about MySQL is available on the -web at http://www.mysql.com/. +logging in $MYSQL_DATA_DIR/mysqld.conf gives you a log in +/var/log/mysql/@mysqlversion/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 check TLD Linux 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 @@ -554,13 +556,13 @@ END_OF_MSG fi # if it's first server, register as default - if [ ! -e /var/lib/mysql{MYSQL_MAJOR}/mysql.sock ] || [ -L /var/lib/mysql{MYSQL_MAJOR}/mysql.sock ] && [ -z "$(readlink /var/lib/mysql{MYSQL_MAJOR}/mysql.sock)" ]; then - sock=${MYSQL_SOCKET#/var/lib/mysql{MYSQL_MAJOR}/} # make it relative if possible - ln -s "$sock" /var/lib/mysql{MYSQL_MAJOR}/mysql.sock + if [ ! -e /var/lib/mysql/@mysqlversion@/mysql.sock ] || [ -L /var/lib/mysql/@mysqlversion@/mysql.sock ] && [ -z "$(readlink /var/lib/mysql/@mysqlversion@/mysql.sock)" ]; then + sock=${MYSQL_SOCKET#/var/lib/mysql/@mysqlversion@/} # make it relative if possible + ln -s "$sock" /var/lib/mysql/@mysqlversion@/mysql.sock fi # same for config, move to /etc - if [ ! -e /etc/mysql{MYSQL_MAJOR}/mysqld.conf ]; then - mv "$MYSQL_CLUSTER_DIR/mysqld.conf" /etc/mysql{MYSQL_MAJOR}/mysqld.conf + if [ ! -e /etc/mysql/@mysqlversion@/mysqld.conf ]; then + mv "$MYSQL_CLUSTER_DIR/mysqld.conf" /etc/mysql/@mysqlversion@/mysqld.conf fi } @@ -595,8 +597,8 @@ stop() { } condrestart() { - if [ ! -f /var/lock/subsys/mysql{MYSQL_MAJOR} ]; then - msg_not_running "MySQL{MYSQL_MAJOR}" + if [ ! -f /var/lock/subsys/mysql-@mysqlversion@ ]; then + msg_not_running "MySQL" RETVAL=$1 return fi @@ -614,7 +616,7 @@ status() { RETVAL=0 addr=${MYSQL_BIND_ADDRESS:-0.0.0.0} port=${MYSQL_PORT:-3306} - socket=${MYSQL_SOCKET:-/var/lib/mysql{MYSQL_MAJOR}/mysql.sock} + socket=${MYSQL_SOCKET:-/var/lib/mysql/@mysqlversion@/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" @@ -631,7 +633,7 @@ status() { echo done - for pid in $(/sbin/pidof mysqld{MYSQL_MAJOR}); do + for pid in $(/sbin/pidof mysqld); do if [[ $pids != */$pid/* ]]; then running="$running $pid" fi @@ -648,7 +650,7 @@ status() { if [ "$MYSQL_STATUS" = "running" ]; then addr=${MYSQL_BIND_ADDRESS:-0.0.0.0} port=${MYSQL_PORT:-3306} - socket=${MYSQL_SOCKET:-/var/lib/mysql{MYSQL_MAJOR}/mysql.sock} + socket=${MYSQL_SOCKET:-/var/lib/mysql/@mysqlversion@/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" @@ -693,8 +695,8 @@ case "$action" in for mysqldir in $DB_CLUSTERS; do mysqlgetconfig "$mysqldir" # just if mysqld is really running - if /usr/bin/mysqladmin{MYSQL_MAJOR} --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" ping >/dev/null 2>&1; then - /usr/bin/mysqladmin{MYSQL_MAJOR} --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" flush-logs + if @mysqlbindir@/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" ping >/dev/null 2>&1; then + @mysqlbindir@/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" flush-logs fi done ;; diff --git a/mysql.logrotate b/mysql.logrotate index 26a4e69..1de8f49 100644 --- a/mysql.logrotate +++ b/mysql.logrotate @@ -11,12 +11,12 @@ # # You must do this for every active cluster defined in /etc/mysql/clusters.conf -/var/log/mysql{MYSQL_MAJOR}/query.log -/var/log/mysql{MYSQL_MAJOR}/mysqld.log -/var/log/mysql{MYSQL_MAJOR}/slow.log -/var/log/mysql{MYSQL_MAJOR}/update* +/var/log/mysql/@mysqlversion@/query.log +/var/log/mysql/@mysqlversion@/mysqld.log +/var/log/mysql/@mysqlversion@/slow.log +/var/log/mysql/@mysqlversion@/update* { - olddir /var/log/archive/mysql{MYSQL_MAJOR} + olddir /var/log/archive/mysql/@mysqlversion@ notifempty missingok create 640 mysql mysql @@ -29,6 +29,6 @@ daily postrotate - /sbin/service mysql{MYSQL_MAJOR} flush-logs + /sbin/service mysql-@mysqlversion@ flush-logs endscript } diff --git a/mysql.spec b/mysql.spec index a743ab1..0e53bb8 100644 --- a/mysql.spec +++ b/mysql.spec @@ -50,6 +50,7 @@ Source11: mysql-ndb-cpc.init Source12: mysql-ndb-cpc.sysconfig Source13: mysql-client.conf Source14: my.cnf +Patch0: no_relative_paths.patch Patch1: mysql-system-xxhash.patch Patch17: mysql-5.7-sphinx.patch @@ -99,6 +100,7 @@ Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd Requires: alternatives Requires: %{name}-charsets = %{version}-%{release} +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} Requires: /usr/bin/setsid Requires: rc-scripts >= 0.2.0 @@ -228,6 +230,7 @@ MySQL - це SQL (Structured Query Language) сервер бази даних. M Summary: MySQL - character sets definitions Summary(pl.UTF-8): MySQL - definicje kodowań znaków Group: Applications/Databases +Requires: %{name}-dirs = %{version}-%{release} BuildArch: noarch %description charsets @@ -238,12 +241,36 @@ and server. Ten pakiet zawiera definicje kodowań znaków potrzebne dla serwera i klienta. +%package -n mysql-common +Summary: Common MySQL files and directories +Summary(pl.UTF-8): MySQL - wspólne pliki i katalogi +Group: Applicataion/Databases + +%description -n mysql-common +Common MySQL files and directories. + +%description -n mysql-common -l pl.UTF-8 +MySQL - wspólne pliki i katalogi. + +%package dirs +Summary: Common directories for MysSQL %{mysqlversion} +Summary(pl.UTF-8): Wspólne pliki i katalogi dla MySQL %{mysqlversion} +Group: Applicataion/Databases +Requires: mysql-common >= %{version}-%{release} + +%description dirs +Common directories for MysSQL %{mysqlversion} + +%description dirs -l pl.UTF-8 +Wspólne pliki i katalogi dla MySQL %{mysqlversion} + %package extras Summary: MySQL additional utilities Summary(pl.UTF-8): Dodatkowe narzędzia do MySQL Group: Applications/Databases Requires: alternatives Requires: %{name}-client = %{version}-%{release} +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} %description extras @@ -277,6 +304,7 @@ Summary(uk.UTF-8): MySQL клієнт Group: Applications/Databases Requires: alternatives Requires: %{name}-charsets = %{version}-%{release} +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} Requires: readline >= 6.2 Obsoletes: MySQL-client < 3.22.27 @@ -303,6 +331,7 @@ Este pacote contém os clientes padrão para o MySQL. Summary: Shared libraries for MySQL Summary(pl.UTF-8): Biblioteki współdzielone MySQL Group: Libraries +Requires: %{name}-dirs = %{version}-%{release} Requires: zlib >= 1.2.12 Obsoletes: libmysql10 < 4 Obsoletes: mysql-doc < 4.1.12 @@ -320,6 +349,7 @@ Summary(pt.UTF-8): MySQL - Medições de desempenho Summary(ru.UTF-8): MySQL - хедеры и библиотеки разработчика Summary(uk.UTF-8): MySQL - хедери та бібліотеки програміста Group: Development/Libraries +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} %{?with_ssl:Requires: openssl-devel >= 1.1.1} Requires: zlib-devel >= 1.2.12 @@ -376,22 +406,12 @@ Biblioteki statyczne 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: alternatives +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} %description ndb @@ -406,6 +426,7 @@ Summary: MySQL - NDB Clients Summary(pl.UTF-8): MySQL - programy klienckie NDB Group: Applications/Databases Requires: alternatives +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} %description ndb-client @@ -419,6 +440,7 @@ Summary: MySQL - NDB Management Daemon Summary(pl.UTF-8): MySQL - demon zarządzający NDB Group: Applications/Databases Requires: alternatives +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} %description ndb-mgm @@ -432,6 +454,7 @@ Summary: MySQL - NDB CPC Daemon Summary(pl.UTF-8): MySQL - demon NDB CPC Group: Applications/Databases Requires: alternatives +Requires: %{name}-dirs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} %description ndb-cpc @@ -443,6 +466,7 @@ Ten pakiet zawiera standardowego demona MySQL NDB CPC. %prep %setup -q %{?with_sphinx:-a100} %{!?with_system_boost:-a101} -n mysql-%{version} +%patch0 -p1 %patch1 -p1 %if %{with sphinx} @@ -475,7 +499,7 @@ CPPFLAGS="%{rpmcppflags}" \ -DCMAKE_BUILD_TYPE=%{!?debug:RelWithDebInfo}%{?debug:Debug} \ -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{rpmcflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{rpmcxxflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \ - -DCOMPILATION_COMMENT="PLD/Linux Distribution MySQL RPM" \ + -DCOMPILATION_COMMENT="TLD Linux MySQL RPM" \ -DCURSES_INCLUDE_PATH=/usr/include/ncurses \ %{?with_systemtap:-DENABLE_DTRACE=ON} \ -DFEATURE_SET="community" \ @@ -486,15 +510,16 @@ CPPFLAGS="%{rpmcppflags}" \ -DINSTALL_LIBDIR=%{_lib} \ -DINSTALL_PRIV_LIBDIR=%{_libdir}/mysql/%{mysqlversion}/private \ -DINSTALL_MYSQLTESTDIR_RPM="" \ + -DINSTALL_MYSQLDATADIR=/var/lib/mysql/%{mysqlversion} \ -DINSTALL_PLUGINDIR=%{_lib}/mysql/%{mysqlversion}/plugin \ - -DINSTALL_SECURE_FILE_PRIVDIR=/var/lib/%{name}-files \ + -DINSTALL_SECURE_FILE_PRIVDIR=/var/lib/mysql-files/%{mysqlversion} \ -DINSTALL_SQLBENCHDIR=%{_datadir} \ -DINSTALL_SUPPORTFILESDIR=share/mysql/%{mysqlversion}/support \ -DINSTALL_MYSQLSHAREDIR=share/mysql/%{mysqlversion}/lang \ -DINSTALL_MYSQLTESTDIR=share/mysql/%{mysqlversion}/test \ -DROUTER_INSTALL_LIBDIR=%{_libdir}/mysql/%{mysqlversion}/router/private \ -DROUTER_INSTALL_PLUGINDIR=%{_libdir}/mysql/%{mysqlversion}/router \ - -DMYSQL_UNIX_ADDR=/var/lib/%{name}/mysql.sock \ + -DMYSQL_UNIX_ADDR=/var/lib/mysql/%{mysqlversion}/mysql.sock \ %{?debug:-DWITH_DEBUG=ON} \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ %{!?with_ldap:-DWITH_AUTHENTICATION_LDAP=OFF} \ @@ -521,22 +546,21 @@ CPPFLAGS="%{rpmcppflags}" \ %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,%{name},skel} \ - $RPM_BUILD_ROOT/var/{log/{archive,}/%{name},lib/{%{name},%{name}-files}} \ +install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mysql/%{mysqlversion},skel} \ + $RPM_BUILD_ROOT/var/{log/{archive,}/mysql/%{mysqlversion},lib/{mysql,mysql-files}/%{mysqlversion}} \ $RPM_BUILD_ROOT%{_mysqlhome} \ $RPM_BUILD_ROOT%{_libdir} %{__make} -C build install \ DESTDIR=$RPM_BUILD_ROOT -sed -e 's#{MYSQL_MAJOR}#%{mysqlversion}#g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} - -cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name} -sed -e 's#{MYSQL_MAJOR}#%{mysqlversion}#g' %{SOURCE3} > $RPM_BUILD_ROOT/etc/logrotate.d/%{name} +sed -e 's,@mysqlbindir@,%{_libdir}/mysql/%{mysqlversion}/bin,g; s,@mysqlsbindir@,%{_libdir}/mysql/%{mysqlversion}/sbin,g; s,@mysqlversion@,%{mysqlversion},g;' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/mysql-%{mysqlversion} +sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE2} >$RPM_BUILD_ROOT/etc/sysconfig/mysql-%{mysqlversion} +sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE3} >$RPM_BUILD_ROOT/etc/logrotate.d/mysql-%{mysqlversion} # This is template for configuration file which is created after 'service mysql init' -sed -e 's#{MYSQL_MAJOR}#%{mysqlversion}#g' %{SOURCE4} > mysqld.conf -sed -e 's#{MYSQL_MAJOR}#%{mysqlversion}#g' %{SOURCE5} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/clusters.conf -touch $RPM_BUILD_ROOT/var/log/%{name}/{mysqld,query,slow}.log +sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE4} >mysqld.conf +sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE5} >$RPM_BUILD_ROOT%{_sysconfdir}/mysql/%{mysqlversion}/clusters.conf +touch $RPM_BUILD_ROOT/var/log/mysql/%{mysqlversion}/{mysqld,query,slow}.log mv $RPM_BUILD_ROOT/etc/logrotate.d/{mysqlrouter,%{name}-router} @@ -551,8 +575,8 @@ 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}/mysql/%{mysqlversion}/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 %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/mysql/%{mysqlversion}/mysql-client.conf +ln -s mysql-client.conf $RPM_BUILD_ROOT%{_sysconfdir}/mysql/%{mysqlversion}/my.cnf cp -a %{SOURCE14} $RPM_BUILD_ROOT/etc/skel/.my.cnf # NDB @@ -705,7 +729,7 @@ fi %posttrans client update-alternatives \ - --install %{_bindir}/mysql mysql %{_libdir}/mysql/%{mysqlversion}/bin/mysql %{mysqlprioity} \ + --install %{_bindir}/mysql mysql %{_libdir}/mysql/%{mysqlversion}/bin/mysql %{mysqlpriority} \ --slave %{_mandir}/man1/mysql.1 mysql.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysql.1* || : update-alternatives \ --install %{_bindir}/mysqladmin mysqladmin %{_libdir}/mysql/%{mysqlversion}/bin/mysqladmin %{mysqlpriority} \ @@ -920,7 +944,7 @@ fi %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}-router %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(640,root,mysql) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mysql/%{mysqlversion}/clusters.conf %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/ibd2sdi %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysql_migrate_keyring %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter @@ -935,9 +959,6 @@ fi %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/sbin/mysql_upgrade %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/sbin/mysqlcheck %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/sbin/mysqld - -%dir %{_libdir}/mysql/%{mysqlversion} -%dir %{_libdir}/mysql/%{mysqlversion}/plugin %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/plugin/adt_null.so %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/plugin/auth.so %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/plugin/auth_socket.so @@ -979,9 +1000,7 @@ fi %if %{with sphinx} %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/plugin/ha_sphinx.so %endif -%dir %{_libdir}/mysql/%{mysqlversion}/private %{_libdir}/mysql/%{mysqlversion}/private/icudt*l -%dir %{_libdir}/mysql/%{mysqlversion}/router %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/connection_pool.so %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/destination_status.so %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_auth_backend.so @@ -998,7 +1017,6 @@ fi %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/router_openssl.so %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/router_protobuf.so %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/routing.so -%dir %{_libdir}/mysql/%{mysqlversion}/router/private %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/private/libmysqlharness*.so* %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/private/libmysqlrouter*.so* %{_datadir}/mysql/%{mysqlversion}/man/man1/ibd2sdi.1* @@ -1016,17 +1034,12 @@ fi %if %{?debug:1}0 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/*resolve_stack_dump -%{_datadir}/%{name}/mysqld.sym +%{_datadir}/mysql/%{mysqlversion}/mysqld.sym %{_datadir}/mysql/%{mysqlversion}/man/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/%{name} -%attr(750,mysql,mysql) %dir /var/lib/%{name}-files -%attr(750,mysql,mysql) %dir /var/log/%{name} -%attr(750,mysql,mysql) %dir /var/log/archive/%{name} -%attr(640,mysql,mysql) %ghost /var/log/%{name}/* +%attr(640,mysql,mysql) %ghost /var/log/mysql/%{mysqlversion}/* # This is template for configuration file which is created after 'service mysql init' %{_datadir}/mysql/%{mysqlversion}/mysqld.conf @@ -1065,9 +1078,35 @@ fi %files charsets %defattr(644,root,root,755) -%dir %{_datadir}/mysql/%{mysqlversion}/lang %{_datadir}/mysql/%{mysqlversion}/lang/charsets +%files -n mysql-common +%attr(751,root,root) %dir %{_sysconfdir}/mysql +%attr(751,root,root) %dir %{_libdir}/mysql +%attr(751,root,root) %dir %{_datadir}/mysql +%attr(751,root,root) %dir /var/lib/mysql +%attr(751,root,root) %dir /var/lib/mysql-files + +%files dirs +%attr(751,root,root) %dir %{_sysconfdir}/mysql/%{mysqlversion} +# root:root is proper here for mysql.rpm while mysql:mysql is potential security hole +%attr(751,root,root) %dir /var/lib/mysql/%{mysqlversion} +%attr(750,mysql,mysql) %dir /var/lib/mysql-files/%{mysqlversion} +%attr(750,mysql,mysql) %dir /var/log/mysql/%{mysqlversion} +%attr(750,mysql,mysql) %dir /var/log/archive/mysql/%{mysqlversion} +%dir %{_libdir}/mysql/%{mysqlversion} +%dir %{_libdir}/mysql/%{mysqlversion}/bin +%dir %{_libdir}/mysql/%{mysqlversion}/sbin +%dir %{_libdir}/mysql/%{mysqlversion}/plugin +%dir %{_libdir}/mysql/%{mysqlversion}/private +%dir %{_libdir}/mysql/%{mysqlversion}/router +%dir %{_libdir}/mysql/%{mysqlversion}/router/private +%dir %{_datadir}/mysql/%{mysqlversion} +%dir %{_datadir}/mysql/%{mysqlversion}/man +%dir %{_datadir}/mysql/%{mysqlversion}/man/man1 +%dir %{_datadir}/mysql/%{mysqlversion}/man/man8 +%dir %{_datadir}/mysql/%{mysqlversion}/lang + %files extras %defattr(644,root,root,755) %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/myisam_ftdump @@ -1108,9 +1147,8 @@ fi %files libs %defattr(644,root,root,755) -%attr(751,root,root) %dir %{_sysconfdir}/%{name} -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/mysql-client.conf -%{_sysconfdir}/%{name}/my.cnf +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mysql/%{mysqlversion}/mysql-client.conf +%{_sysconfdir}/mysql/%{mysqlversion}/my.cnf %attr(755,root,root) %{_libdir}/libmysqlclient.so.*.*.* %attr(755,root,root) %ghost %{_libdir}/libmysqlclient.so.22 %if %{with ndb} diff --git a/mysqld.conf b/mysqld.conf index 09808af..0e5fbc2 100644 --- a/mysqld.conf +++ b/mysqld.conf @@ -13,9 +13,9 @@ port = 3306 user = mysql # ssl options -#ssl-ca = /etc/ssl/certs/mysql{MYSQL_MAJOR}/ca-cert.pem -#ssl-cert = /etc/ssl/certs/mysql{MYSQL_MAJOR}/server-cert.pem -#ssl-key = /etc/ssl/certs/mysql{MYSQL_MAJOR}/server-key.pem +#ssl-ca = /etc/ssl/certs/mysql-@mysqlversion@/ca-cert.pem +#ssl-cert = /etc/ssl/certs/mysql-@mysqlversion@/server-cert.pem +#ssl-key = /etc/ssl/certs/mysql-@mysqlversion@/server-key.pem #ssl-cipher = DHE-RSA-AES256-SHA # Don't listen on a TCP/IP port at all. This is a security enhancement, @@ -43,19 +43,19 @@ skip-networking log-output = FILE # mysqld error log (stderr) -log-error = /var/log/mysql{MYSQL_MAJOR}/mysqld.log +log-error = /var/log/mysql/@mysqlversion@/mysqld.log log-error-verbosity = 2 # Log slow queries slow-query-log -slow-query-log-file = /var/log/mysql{MYSQL_MAJOR}/slow.log +slow-query-log-file = /var/log/mysql/@mysqlversion@/slow.log # Log connections and queries. It slows down MySQL so it's disabled by default #general-log -#general-log-file = /var/log/mysql{MYSQL_MAJOR}/query.log +#general-log-file = /var/log/mysql/@mysqlversion/query.log # Log all updates. -#log-update = /var/log/mysql{MYSQL_MAJOR}/update +#log-update = /var/log/mysql/@mysqlversion@/update # Log some extra information to update log #log-long-format -- 2.46.0