diff -Nur smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file --- smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file 2017-03-13 00:21:57.815000000 -0400 +++ smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file 2017-03-13 00:55:06.661000000 -0400 @@ -1 +1 @@ -pid-file=/opt/rh/rh-mysql57/root/var/run/mysqld/mysqld.pid +pid-file=/var/run/rh-mysql57-mysqld/mysqld.pid diff -Nur smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir --- smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir 2017-03-13 00:56:02.390000000 -0400 @@ -0,0 +1 @@ +lc-messages-dir=/opt/rh/rh-mysql57/root/usr/share/rh-mysql57-mysql/english/ diff -Nur smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password smeserver-mysql57-2.0.0/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password --- smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password 2017-02-19 09:44:53.000000000 -0500 +++ smeserver-mysql57-2.0.0/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password 2017-03-13 01:19:45.555000000 -0400 @@ -4,8 +4,8 @@ my $pw = esmith::util::LdapPassword(); $OUT .= "use mysql;\n"; - $OUT .= "ALTER TABLE user MODIFY Password char(41) NOT NULL default '';\n"; - $OUT .= "UPDATE user SET password=password('$pw') WHERE user='root';\n"; + $OUT .= "ALTER TABLE user MODIFY authentication_string TEXT NULL default NULL;\n"; + $OUT .= "UPDATE user SET authentication_string=password('$pw'), password_expired='n' WHERE user='root';\n"; $OUT .= "DELETE FROM user WHERE user='';\n"; $OUT .= "FLUSH PRIVILEGES;\n"; } diff -Nur smeserver-mysql57-2.0.0.old/root/var/service/mysql57-mysqld/run smeserver-mysql57-2.0.0/root/var/service/mysql57-mysqld/run --- smeserver-mysql57-2.0.0.old/root/var/service/mysql57-mysqld/run 2017-03-13 00:21:57.817000000 -0400 +++ smeserver-mysql57-2.0.0/root/var/service/mysql57-mysqld/run 2017-03-13 01:23:10.052000000 -0400 @@ -1,5 +1,7 @@ #! /bin/sh +datadir="/opt/rh/rh-mysql57/root/var/lib/mysql" + # We have to re-enable SCL environment, because /sbin/service # clears almost all environment variables. # Since X_SCLS is cleared as well, we lose information about other @@ -7,20 +9,38 @@ . /opt/rh/rh-mysql57/service-environment for sclname in $RH_MYSQL57_SCLS_ENABLED ; do . /opt/rh/$sclname/enable - export X_SCLS="$X_SCLS $sclname" - done - - # we want start daemon only inside "scl enable" invocation - if ! scl_enabled $sclname ; then - echo "Collection $sclname has to be listed in /opt/rh/rh-mysql57/service-environment" - exit 1 - fi - + export X_SCLS="$X_SCLS $sclname" +done + +# we want start daemon only inside "scl enable" invocation +if ! scl_enabled $sclname ; then + echo "Collection $sclname has to be listed in /opt/rh/rh-mysql57/service-environment" + exit 1 +fi + exec 2>&1 + if [ ! -f /opt/rh/rh-mysql57/root/var/lib/mysql/mysql/user.frm ] then - setuidgid mysql sh /opt/rh/rh-mysql57/root/usr/bin/mysql_install_db - /opt/rh/rh-mysql57/root/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables --socket=/var/lib/mysql/mysql57.sock < ./set.password + echo "Initializing MySQL database" + /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir="$datadir" --user="mysql" + ret=$? + if [ $ret -ne 0 ] ; then + echo "Initialization of MySQL database failed." >&2 + echo "Perhaps /etc/opt/rh/rh-mysql57/my.cnf is misconfigured." >&2 + # Clean up any partially-created database files + if [ ! -e "$datadir/mysql/user.frm" ] ; then + rm -rf "$datadir"/* + fi + exit $ret + fi + # set root password + /opt/rh/rh-mysql57/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < ./set.password + # upgrade does not need to be run on a fresh datadir + echo "5.7.16" >"$datadir/mysql_upgrade_info" + # In case we're running as root, make sure files are owned properly + chown -R "mysql:mysql" "$datadir" + if [ -f /home/e-smith/db/mysql57/mysql.dump ] then /sbin/e-smith/expand-template /etc/e-smith/sql/init57/00_restore_dumped_dbs @@ -30,7 +50,8 @@ exec /opt/rh/rh-mysql57/root/usr/libexec/mysqld \ --defaults-file=/opt/rh/rh-mysql57/root/etc/my.cnf \ --basedir=/opt/rh/rh-mysql57/root/usr \ - --datadir=/opt/rh/rh-mysql57/root/var/lib/mysql \ + --datadir=$datadir \ --user=mysql \ - --pid-file=/opt/rh/rh-mysql57/root/var/run/mysqld/mysqld.pid \ - --socket=/var/lib/mysql/mysql57.sock + --pid-file=/var/run/rh-mysql57-mysqld/mysqld.pid \ + --socket=/var/lib/mysql/mysql57.sock \ + --lc-messages-dir=/opt/rh/rh-mysql57/root/usr/share/rh-mysql57-mysql/english/