11 月 092016
 

 

查看所有视图表

[root@localhost ~]# mysql -uroot -p dbname -e "show full tables where table_type='view'"
Enter password:

编辑视图导出脚本

#vi backupViews.sh

#!/bin/bash
#
/usr/bin/mysql --skip-column-names --batch -e \
"select table_name from information_schema.views \
where table_schema = database()" $* |
xargs --max-args 1 /usr/bin/mysqldump $*

执行视图导出脚本

[root@localhost ~]# ./backupViews.sh -uusername -ppassword dbname > views.sql
Warning: Using a password on the command line interface can be insecure.
......
Warning: Using a password on the command line interface can be insecure.
[root@localhost ~]#