网站运营
位置:首页>> 网站运营>> 使用shell脚本来给mysql加索引的方法

使用shell脚本来给mysql加索引的方法

作者:stpeace  发布时间:2023-10-05 05:01:49 

标签:shell,mysql,索引

用shell脚本来给mysql加索引

刚好用到, mark一下:


#! /bin/bash
tb_base=tb_student_
arr=("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f")
GetCmd()
{
for value in ${arr[@]}
do
for value2 in ${arr[@]}
do
 tb_name=$tb_base$value$value2
 cmd="ALTER TABLE ${tb_name} ADD INDEX seed (uid, name); "
 echo $cmd
done
done
}
GetCmd $1

上面的结果就是要执行的语句,done.

嗯, tb_student_"tb_student_"都可以

来源:https://blog.csdn.net/stpeace/article/details/79070085

0
投稿

猜你喜欢

手机版 网站运营 asp之家 www.aspxhome.com