From 777e270c02aad09ab64d9679c9ce795430fb364c Mon Sep 17 00:00:00 2001 From: zhoupengcheng Date: Sat, 4 Nov 2023 14:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Emysql=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=88=A4=E6=96=AD=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?mysql=E7=A6=BB=E7=BA=BF=E8=B0=83=E4=BC=98=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E9=85=8D=E7=BD=AE=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98(tuning=20--restore)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/tuning/mysql_sysbench/prepare.sh | 10 ++++++++++ examples/tuning/mysql_sysbench/set_params.sh | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/tuning/mysql_sysbench/prepare.sh b/examples/tuning/mysql_sysbench/prepare.sh index 973f80c7..bb96fc33 100644 --- a/examples/tuning/mysql_sysbench/prepare.sh +++ b/examples/tuning/mysql_sysbench/prepare.sh @@ -113,6 +113,16 @@ else sed -i "s#stopworkload:.*#stopworkload: \"systemctl stop mysql\" #g" $path/mysql_sysbench_server.yaml fi +echo "Setting the executable path of the MySQL database" +if [ -f /usr/bin/mysql ]; then + sed -i 's/MySQL_EXEC_PATH/\/usr\/bin\/mysql/g' $path/set_params.sh +elif [ -f /usr/local/mysql/bin/mysql ]; then + sed -i 's/MySQL_EXEC_PATH/\/usr\/local\/mysql\/bin\/mysql/g' $path/set_params.sh +else + echo "Setting failed! No available mysql executable file is found." + exit 1 +fi + echo "copy the server yaml file to /etc/atuned/tuning/" rm -rf /etc/atuned/tuning/mysql_sysbench_server.yaml sed -i "s#PATH#$path#g" $path/server.yaml diff --git a/examples/tuning/mysql_sysbench/set_params.sh b/examples/tuning/mysql_sysbench/set_params.sh index 698bf576..129f38e7 100644 --- a/examples/tuning/mysql_sysbench/set_params.sh +++ b/examples/tuning/mysql_sysbench/set_params.sh @@ -1,8 +1,8 @@ params=$1 value=$2 -/usr/local/mysql/bin/mysql -uroot -p123456 << EOF +MySQL_EXEC_PATH -uroot -p123456 << EOF set GLOBAL $params = $2; quit EOF -sed -i "s/^$params=.*$/$params=$value/g" /etc/my.cnf \ No newline at end of file +sed -i "s/^$params=.*$/$params=$value/g" /etc/my.cnf -- Gitee