0

我有一个 .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

+ 其他一些表格

这实际上意味着语法错误在注释后的第一行?你能帮我解决这个问题吗?在跛脚的眼睛看来它是有效的。

提前致谢 :)

4

1 回答 1

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 语法。

于 2013-10-24T21:20:32.837 回答