Skip to content

Instantly share code, notes, and snippets.

@doublemarket
Last active December 15, 2015 18:49
Show Gist options
  • Save doublemarket/5306525 to your computer and use it in GitHub Desktop.
Save doublemarket/5306525 to your computer and use it in GitHub Desktop.
データベース名を引数に渡すと、そのデータベース内のテーブルのインデックスをkey_bufferに読み込むシェルスクリプト。 MyISAMのテーブルでしか使えません。
#!/bin/sh
CMDNAME=$0
if [ $# -le 0 ] ;then
echo "Usage: $CMDNAME database database ..."
fi
shift `expr $OPTIND - 1`
for database in $@ ;do
tables=`mysql -uroot $database -N -e 'show tables'`
for table in $tables ;do
echo "`date` load index into cache $table"
mysql -uroot $database -e "load index into cache $table"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment