Skip to content

Instantly share code, notes, and snippets.

@woodphil
Last active May 25, 2016 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodphil/00db5175d44ce8793b46819d30514caa to your computer and use it in GitHub Desktop.
Save woodphil/00db5175d44ce8793b46819d30514caa to your computer and use it in GitHub Desktop.
Grab the table schema and columns of a mysql db
mysql -h<hostname> -u<username> -p<password> >output.txt << EOF
SELECT table_name, column_name, column_type
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema='<db_name>'
ORDER BY table_name, ordinal_position;
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment