mdb-tools mySQL语法错误

时间:2013-10-24 16:22:47

标签: mysql ms-access mdbtools

我有一个.mdb文件,我正在尝试导出到mySQL数据库。 使用mdb-schema Data.mdb | mysql -u root -p Database 我收到以下错误:

ERROR 1064 (42000) at line 11: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[Attachments]
 (
    [ItemID]            Long Integer, 
    [Description]           Text (510), 
    [Pare' at line 1

mdb-schema的代码输出(在管道实际看起来像之前)<>

  1 -- ----------------------------------------------------------
  2 -- MDB Tools - A library for reading MS Access database files
  3 -- Copyright (C) 2000-2011 Brian Bruns and others.
  4 -- Files in libmdb are licensed under LGPL and the utilities under
  5 -- the GPL, see COPYING.LIB and COPYING files respectively.
  6 -- Check out http://mdbtools.sourceforge.net
  7 -- ----------------------------------------------------------
  8 
  9 -- That file uses encoding UTF-8
 10 
 11 CREATE TABLE [Attachments]
 12  (
 13         [ItemID]                        Long Integer,
 14         [Description]                   Text (510),
 15         [ParentItemID]                  Long Integer,
 16         [Path]                  Memo/Hyperlink (255),
 17         [AttachmentType]                        Long Integer,
 18         [Notes]                 Text (510),
 19         [Imported]                      Boolean NOT NULL
 20 );
 21

+其他一些表

这有效意味着语法错误在评论后的第一行?你能帮我解决这个问题吗?跛脚的眼睛看起来很有效。

提前致谢:)

1 个答案:

答案 0 :(得分:1)

根据man mdb-schema,我们可以在数据库名称后面包含一个可选的backend参数。我试过的时候

mdb-schema test.mdb mysql > output.txt

输出文件包含此

-- ----------------------------------------------------------
-- MDB Tools - A library for reading MS Access database files
-- Copyright (C) 2000-2011 Brian Bruns and others.
-- Files in libmdb are licensed under LGPL and the utilities under
-- the GPL, see COPYING.LIB and COPYING files respectively.
-- Check out http://mdbtools.sourceforge.net
-- ----------------------------------------------------------

-- That file uses encoding UTF-8

CREATE TABLE `Contacts`
 (
    `ID`            int, 
    `LastName`          varchar (510), 
    `FirstName`         varchar (510), 
    `Notes`         text (255)
);

与问题中的示例相比,它看起来更接近MySQL语法。