当前位置: 移动技术网 > 网络运营>服务器>Linux > 使用shell脚本来给mysql加索引的方法

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

2019年07月18日  | 移动技术网网络运营  | 我要评论
用shell脚本来给mysql加索引 刚好用到, mark一下: #! /bin/bash tb_base=tb_student_ arr=("0" "1"

用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_"都可以

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对移动技术网的支持。如果你想了解更多相关内容请查看下面相关链接

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网