Quick & cheap MySQL FOREIGN KEY report in bash
Wednesday, April 4th, 2007Gives a simple list of tables and the FOREIGN KEY constraints on them. Worked for me, anyway:
mysql -u [user] -p[password] -h [host] [database] <<< “SHOW TABLES;” | \
while read table; do
mysql -u [user] -p[password] -h [host] [database] <<< “SHOW CREATE TABLE $table;”;
echo “^M^M^M”;
done | \
grep ‘CONSTRAINT’ | \
sed ’s/$/\n/’ | \
sed ’s/\(.*\)\(CREATE […]

