#!/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
#
. /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
# 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"
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
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
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}
#
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
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"
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
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
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 \
# 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
# 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
# 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
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"
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
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
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:
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)
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
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
}
}
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
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"
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
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"
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
;;
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
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
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
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
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
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
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
Цей пакет містить статичні бібліотеки програміста, необхідні для
розробки програм-клієнтів.
-%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
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
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
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
%prep
%setup -q %{?with_sphinx:-a100} %{!?with_system_boost:-a101} -n mysql-%{version}
+%patch0 -p1
%patch1 -p1
%if %{with sphinx}
-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" \
-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} \
%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}
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
%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} \
%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
%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
%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
%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*
%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
%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
%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}