]> arthur.barton.de Git - MkMySqlDump.git/blobdiff - bin/mkmysqlslave
Correctly set password variable fro mysql[_dump]
[MkMySqlDump.git] / bin / mkmysqlslave
index fa60b93cd5c3957b25b6d4ade5d7301ea1e11046..7985f3f2ae1cf7e766f7e1161612895e70436d54 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # mkmysqlslave -- import MySQL master data and start slave
-# Copyright (c)2015 Alexander Barton <alex@barton.de>
+# Copyright (c)2015-2016 Alexander Barton <alex@barton.de>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -76,7 +76,7 @@ fi
 
 echo "Initializing MySQL server on \"$MYHOST\" (user \"$MYUSER\") as replication slave:"
 
-[ -n "$MYPW" ] && PWSWITCH="--password='$MYPW'" || PWSWITCH=""
+[ -n "$MYPW" ] && PWSWITCH="--password=$MYPW" || PWSWITCH=""
 
 echo "Stopping running slave threads ..."
 mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH -e 'stop slave'; r=$?
@@ -87,11 +87,11 @@ fi
 echo "Start: $(date)"
 if [ "$INFILE" != "-" ]; then
        echo "Importing \"$INFILE\" ..."
-       mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH <"$INFILE"; r=$?
 else
        echo "Importing from standard input ..."
-       mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH; r=$?
 fi
+( echo "SET SESSION SQL_LOG_BIN=0;"; cat "$INFILE" ) \
+       | mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH; r=$?
 echo "End: $(date)"
 if [ $r -ne 0 ]; then
        echo "MySQL import FAILED, code $r!" >&2