MySqlErd is a small Java program that can connect to a MySQL database and extract foreign key relations and table structure to produce a DOT description. This can be processed by Graphviz to produce a graphical rendering of the database structure. An example of the output as rendered by Graphviz and converted to PDF can be seen here.
Not all databases can be 'read' to produce an ERD using MySqlErd. In particular the following conditions are needed:
MySqlErd is distributed as a Java JAR file, and can be ran as follows:
$ java -jar MySqlErd.jar
This will list the command line options needed to specify a host, user, database and password. These options can be supplied to the tool, with the output piped to Graphviz DOT (which will need installing as per the Graphviz web site).
$ java -jar MySqlErd.jar -h dbserver -u mysql -D example | dot -T ps -o erd.ps
If all goes to plan, erd.ps will be produced giving an ERD of the database. Graphviz supports a number of output formats, including PNG, GIF, SVG and FIG, although this example will produce Postscript output suitable for printing.
This software is available under the terms of the GPL, so feel free to download use and distribute!
The software can be downloaded as a JAR file, which also contains the source and JavaDocs - simply rename to a zip file and extract the contents if you want these additional items.