3

I'm new to Linux and have just installed Fedora 19 in VirtualBox.

I am running MariaDB and am wanting to generate database diagrams from the command line.

I have come across a few examples of output from SQLFairy:

http://nsaunders.wordpress.com/2009/01/11/easy-visualisation-of-database-schemas-using-sqlfairy/

http://www.christianbiggins.com/2008/11/er-diagrams-from-sql-files.html

http://techmania.wordpress.com/2008/06/09/creating-er-diagrams-from-sql/

And that seems to be the type of thing I am after.

I did a yum search with 'yum search sqlfairy' but there didn't seem to be any results.

Could anyone please tell me how to install sqlfairy in Fedora 19, or, if that's not possible, recommend a product that does a similar thing?

Edit:

I found this: https://admin.fedoraproject.org/pkgdb/acls/name/perl-SQL-Translator#f19

and installed via yum install perl-SQL-Translator.

I am now trying:

[me@my ~]  sqlt-graph -f MySQL -o mydatabase.png -t png mydatabase.sql

but am getting error:

ERROR (line 36): Invalid statement: Was expecting comment, 
or use, or set, or drop, or create, or alter, or insert, or 
delimiter, or empty statement
Error: translate: Error with parser 'SQL::Translator::Parser::MySQL':  
no results at /usr/bin/sqlt-graph line 195.

The .sql file is located is home/me which is where I am running the command from.

4

2 回答 2

2

解决方案是按照上面的步骤,通过使用以下mysqldump命令解决了错误,然后上面的sqlt命令起作用了:

[username@hostname ~] mysqldump -u root -pmysql_root_password --no-data database_name > example.sql
于 2013-08-02T14:13:25.193 回答
1

看看SchemaCrawler,它可以从命令行生成数据库图表。它适用于 Linux,需要安装 Java。您需要找到 MariaDB 的 JDBC 驱动程序。

Sualeh Fatehi,SchemaCrawler

于 2013-08-15T04:28:24.083 回答