Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting MySQL Schemas for All Tables

Tags:

sql

mysql

I want to download/backup the schema of an entire MySQL database. Is there a way to easily do this? I haven't had much luck using a wildcard, but that could be an error on my part.

like image 800
waiwai933 Avatar asked Aug 10 '10 02:08

waiwai933


1 Answers

Login as root, then

show databases; # lists all databases
use information_schema; # connect to the mysql schema
show tables;   
select * from tables;

Everything you need is in the information_schema schema. If all you want to do is backup the db, use the builtin dump/restore capabilities.

like image 78
Jim Garrison Avatar answered Oct 26 '22 18:10

Jim Garrison