#!/bin/bash
db_name="cert"
mysql_user="root"
mysql_passwd="34567"
table_name=`mysql -u$mysql_user -p$mysql_passwd -e "select table_name from information_schema.tables where table_schema=‘$db_name‘ and table_type=‘base table‘;"|grep -v table_name`
for a in $table_name
do
echo -e "\n$a 表中的字段\n"
mysql -u$mysql_user -p$mysql_passwd -e "select * from $db_name.$a limit 1;"|sed -n "1p"|awk ‘{for(i=1;i<=NF;i++)print $i}‘
done
原文地址:http://blog.51cto.com/quliren/2071300
时间: 2024-10-29 19:06:34