Created
April 5, 2010 14:15
-
-
Save n0ts/356380 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MYSQL=/usr/bin/mysql | |
DATABASE="test" | |
SOCKET="/var/lib/mysql/mysql.sock" | |
# listed all tables | |
for table in `$MYSQL -u root $DATABASE -N -s -e 'show tables'`; | |
do | |
# show columns from table | |
columns=`$MYSQL -u root $DATABASE -e "show columns from $table"` | |
echo | |
echo "${table} - `echo $table | wc -l | tr -d ' '` columns" | |
echo "---" | |
echo -n "$columns" | |
# show indexes from table \G | |
indexes=`$MYSQL -u root $DATABASE -e "show indexes from $table"` | |
echo | |
echo | |
echo "${table} - `echo $indexes | wc -l | tr -d ' '` indexes" | |
echo "---" | |
echo -n "$indexes" | |
# show table status from neoad_dev like 'table' \G; | |
engine=`$MYSQL -u root $DATABASE -e "show table status from $DATABASE like '$table' \G" | grep "Engine: "` | |
echo | |
echo | |
echo "${table} - `echo $engine`" | |
echo | |
echo | |
echo | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment