1

Want to open .frm file from MySQL Workbench to see models of a database design.

I am using File -> Open Model ..., but cannot select .frm file.

Does anyone have any thoughts?

davejal
  • 6,009
  • 10
  • 39
  • 82
Lin Ma
  • 9,739
  • 32
  • 105
  • 175

2 Answers2

1

Mysql workbench is not designed to open .frm files directly to retrieve table information. It can reverse engineer a database structure from DDL script (create table commands) or by connecting to a database on a mysql server (commercial version only).

So, import the table into a database on your mysql server, run show create table tablename command to get the DDL statement for the table, and you can reverse engineer the structure in mysql workbench using this statement.

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • for the tablename, does it have to be the same as original table? Thanks. – Lin Ma Nov 12 '15 at 01:56
  • 1
    Tablename is the name of the table after the import, so I do not understand your question. – Shadow Nov 12 '15 at 02:24
  • Hi Shadow, I mean whether I need the same table name? My confusion is, there are a lot of tables (I have the whole database in .FRM .MYD and .MYI formats for all the tables) and I need to do them one by one? – Lin Ma Nov 12 '15 at 02:27
  • 1
    I'm sorry, but this is a completely different question than what you asked. If you are looking for a way to recover a database using the files, then look at the links davejal provided. – Shadow Nov 12 '15 at 02:32
0

While it is not possible to open them directly in MysqlWorkbench you can restore the database if that's what you need.

Mysql requires both the .frm file and the .myd file to recognize it according to fileinfo

Another option would be mysqlfrm

davejal
  • 6,009
  • 10
  • 39
  • 82
  • Hi davejal, I have both files and wondering how to open them using MySQL Workbench? Thanks. – Lin Ma Nov 12 '15 at 01:34
  • 1
    While it is not possible to oppen it directly into the workbench, Check out this http://stackoverflow.com/questions/879176/how-to-recover-mysql-db-from-myd-myi-frm-files and http://stackoverflow.com/questions/23231018/open-existing-db-in-mysql-workbench – davejal Nov 12 '15 at 01:36
  • Thanks davejal, I read instructions like "plopping the .FRM, .MYD, and .MYI files into a database directory (e.g., /var/lib/mysql/dbname) will make that table available", confused what does it mean? Does it mean I just need to copy the .FRM .MYD and .MYI files into /var/lib/mysql/dbname? – Lin Ma Nov 12 '15 at 01:45
  • 1
    there are different options, read the other answers too by Vishal and Alnel – davejal Nov 12 '15 at 01:50
  • Thanks davejal for the hint, and for the solution of "Create a dummy database (say abc)", the database name "abc" needs to be exactly the original database name? – Lin Ma Nov 12 '15 at 01:58
  • 1
    Please provide more details in your question. I seems like your trying to recover a db. actually I think it can be anything, but if you remember the name of the db try that first – davejal Nov 12 '15 at 02:03
  • Hi davejal, the task I am doing is, I am trying to extract some data from a database, not necessarily to recover the exact one. But the database data provided to me is only in .FRM .MYD and .MYI form, and it is why I come here to ask advice how to import them into a MySQL database, so that I can further extract some data -- extract some data I mean execute some SQL select statement. :) Your advice is highly appreciated. – Lin Ma Nov 12 '15 at 02:26
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/94880/discussion-between-davejal-and-lin-ma). – davejal Nov 12 '15 at 02:28