#! /bin/bash
db_list=`mysql -e "show databases" `
for db in $db_list ; do
>$db.sql
view_list=`mysql -e "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_TYPE LIKE 'VIEW' AND TABLE_SCHEMA LIKE '${db}';" | grep -v TABLE_NAME`
for view in $view_list;do
echo "$db $view"
echo "drop view IF EXISTS $view ;" >>$db.sql
echo "drop
(
Read more... )