From: Marcin Krol Date: Sat, 30 Dec 2023 11:34:51 +0000 (+0100) Subject: - paths fixes, init fixes, misc fixes, works, release 1 X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=5546df71dcd4dc874cf175fff469582bb84c5022;p=packages%2Fmysql.git - paths fixes, init fixes, misc fixes, works, release 1 --- diff --git a/mysql-clusters.conf b/mysql-clusters.conf index c617647..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 +mysqld.conf=/var/lib/mysql/@mysqlversion@/main diff --git a/mysql.init b/mysql.init index 120f67b..00f9494 100755 --- a/mysql.init +++ b/mysql.init @@ -13,26 +13,26 @@ . /etc/sysconfig/network # Get service config -if [ -f /etc/sysconfig/mysql ]; then - . /etc/sysconfig/mysql +if [ -f /etc/sysconfig/mysql-@mysqlversion@ ]; then + . /etc/sysconfig/mysql-@mysqlversion@ else - nls "Error: %s not found" /etc/sysconfig/mysql + 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/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/clusters.conf ]; then - MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/ && /=/{print $2}' /etc/mysql/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/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 (compatibility mode)" @@ -51,7 +51,7 @@ else exit 0 fi -sharedir=/usr/share/mysql +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/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/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/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/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_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,19 +159,13 @@ 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 + 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 - 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 + config_file="$clusterdir/mysqld.conf" fi MYSQL_CLUSTER_DIR="$clusterdir" @@ -248,11 +242,7 @@ mysqlgetconfig() { unset MYSQL_LOG_ERROR fi - if is_yes "$MYSQL_RA_COMPAT"; then - MYSQL_DATA_DIR_SUB="" - else - MYSQL_DATA_DIR_SUB="/mysqldb" - fi + MYSQL_DATA_DIR_SUB="/mysqldb" 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" @@ -289,7 +279,7 @@ mysqlstart() { TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \ - /usr/bin/setsid /usr/sbin/mysqld \ + /usr/bin/setsid @mysqlsbindir@/mysqld \ --defaults-file=$MYSQL_CONFIG \ --datadir=$MYSQL_DATA_DIR \ --pid-file=$MYSQL_PIDFILE \ @@ -336,7 +326,7 @@ mysqlstop() { # 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 + @mysqlbindir@/mysqladmin --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown >/dev/null 2>&1 mysqlstatus "$clusterdir" stop if [ "$MYSQL_PID" != "unknown" ]; then @@ -360,7 +350,7 @@ mysqlstop() { # report slave status # uses MYSQL_SOCKET - path to mysql socket slave_status() { - if [ ! -x /usr/bin/mysql ]; then + if [ ! -x @mysqlbindir@/mysql ]; then echo >&2 "Slave status not available: 'mysql' program not installed." return fi @@ -445,7 +435,7 @@ mysqlinit() { 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" @@ -487,17 +477,17 @@ mysqlinit() { fi ok=0 - /usr/sbin/mysqld \ + @mysqlsbindir@/mysqld \ --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \ - --initialize \ + --initialize-insecure \ --skip-grant-tables \ --datadir=$MYSQL_DATA_DIR \ --user=$MYSQL_USER \ - --slave-load-tmpdir=$MYSQL_DATA_DIR \ + --replica-load-tmpdir=$MYSQL_DATA_DIR \ --tmpdir=$MYSQL_DATA_DIR \ --log-error=$MYSQL_ERRLOG \ && ok=1 - [ -f $MYSQL_DATA_DIR/mysql/user.frm ] || ok=0 + [ -f $MYSQL_DATA_DIR/mysql.ibd ] || ok=0 if [ "$ok" = 1 ]; then ok @@ -547,20 +537,20 @@ ERROR: Examine the logs in $MYSQL_ERRLOG for more information. You can also try to start the mysqld daemon with: -/usr/sbin/mysqld --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 -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/query.log that +logging in $MYSQL_DATA_DIR/mysqld.conf gives you a log in /var/log/mysql/mysql-8.0-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 @@ -571,13 +561,13 @@ END_OF_MSG fi # if it's first server, register as default - 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 + 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/mysqld.conf ]; then - mv "$MYSQL_CLUSTER_DIR/mysqld.conf" /etc/mysql/mysqld.conf + if [ ! -e /etc/mysql/@mysqlversion@/mysqld.conf ]; then + mv "$MYSQL_CLUSTER_DIR/mysqld.conf" /etc/mysql/@mysqlversion@/mysqld.conf fi } @@ -631,7 +621,7 @@ status() { RETVAL=0 addr=${MYSQL_BIND_ADDRESS:-0.0.0.0} port=${MYSQL_PORT:-3306} - socket=${MYSQL_SOCKET:-/var/lib/mysql/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" @@ -665,7 +655,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.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" @@ -710,8 +700,8 @@ case "$action" in 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 + 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 4bb78ce..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/query.log -/var/log/mysql/mysqld.log -/var/log/mysql/slow.log -/var/log/mysql/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 + olddir /var/log/archive/mysql/@mysqlversion@ notifempty missingok create 640 mysql mysql @@ -29,6 +29,6 @@ daily postrotate - /sbin/service mysql flush-logs + /sbin/service mysql-@mysqlversion@ flush-logs endscript } diff --git a/mysql.spec b/mysql.spec index 9730bd7..45b9a0a 100644 --- a/mysql.spec +++ b/mysql.spec @@ -26,7 +26,7 @@ Summary(uk.UTF-8): MySQL - швидкий SQL-сервер Summary(zh_CN.UTF-8): MySQL数据库服务器 Name: mysql-%{mysqlversion} Version: 8.0.35 -Release: 0.1 +Release: 1 License: GPL v2 + MySQL FOSS License Exception Group: Applications/Databases Source0: http://cdn.mysql.com/Downloads/MySQL-%{mysqlversion}/mysql-%{version}.tar.gz @@ -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 @@ -226,6 +228,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 @@ -236,12 +239,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 @@ -275,6 +302,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 @@ -301,6 +329,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 @@ -318,6 +347,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 @@ -374,22 +404,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 @@ -404,6 +424,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 @@ -417,6 +438,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 @@ -430,6 +452,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 @@ -441,6 +464,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} @@ -473,7 +497,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" \ @@ -484,15 +508,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} \ @@ -519,22 +544,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} @@ -549,8 +573,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 @@ -703,7 +727,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} \ @@ -918,7 +942,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 @@ -933,9 +957,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 @@ -977,9 +998,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 @@ -996,7 +1015,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* @@ -1014,17 +1032,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 @@ -1063,9 +1076,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 @@ -1106,9 +1145,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.21 %if %{with ndb} diff --git a/mysqld.conf b/mysqld.conf index 658fb6d..0e5fbc2 100644 --- a/mysqld.conf +++ b/mysqld.conf @@ -13,37 +13,11 @@ 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-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 -#character-set-server=latin2 -#collation-server=latin2_general_ci -#skip-character-set-client-handshake - -# This variable controls the password hashing method used by the PASSWORD() -# function. It also influences password hashing performed by CREATE USER and -# GRANT statements that specify a password using an IDENTIFIED BY clause. -# http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_old_passwords -# Value | Password Hashing Method | Associated Authentication Plugin -# 0 | MySQL 4.1 native hashing | mysql_native_password -# 1 | Pre-4.1 ("old") hashing | mysql_old_password -# 2 | SHA-256 hashing | sha256_password -# If you set old_passwords=2, follow the instructions for using the sha256_password plugin at -# http://dev.mysql.com/doc/refman/5.6/en/sha256-authentication-plugin.html -#old-passwords=0 - -# 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. @@ -58,62 +32,6 @@ skip-networking # 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 - # https://dev.mysql.com/doc/refman/5.6/en/log-destinations.html # global option where logs be written # affects slow-query-log, general-log direcives @@ -125,19 +43,19 @@ skip-networking log-output = FILE # mysqld error log (stderr) -log-error = /var/log/mysql/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/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/query.log +#general-log-file = /var/log/mysql/@mysqlversion/query.log # Log all updates. -#log-update = /var/log/mysql/update +#log-update = /var/log/mysql/@mysqlversion@/update # Log some extra information to update log #log-long-format @@ -148,87 +66,6 @@ slow-query-log-file = /var/log/mysql/slow.log # 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 -# http://www.mysqlperformanceblog.com/2012/06/04/thread_concurrency-doesnt-do-what-you-expect/ -# thread_concurrency is deprecated, removed in 5.6.1 and works on old Solaris versions < 9 -#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. -# http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_myisam-recover-options -myisam-recover-options - -#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_log_group_home_dir = @clusterdir@/mysqldb/db -innodb_log_files_in_group=2 - -#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 or status check for replications [client] user = mysql_sysadmin