Skip to content

Instantly share code, notes, and snippets.

@forthxu
Created December 6, 2017 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forthxu/e2233666dff7eb5ad176d77516df212e to your computer and use it in GitHub Desktop.
Save forthxu/e2233666dff7eb5ad176d77516df212e to your computer and use it in GitHub Desktop.
批量处理mysql数据表
#!/bin/bash
tables=`mysql -uroot jipai -e "select table_name from information_schema.tables where table_schema='jipai' and table_type='base table';" --batch --raw --skip-column-names`
for table in ${tables[@]}
do
echo ${table}, `mysql -uroot jipai -e "select count(*) from ${table};" --skip-column-names`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment