首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mdb-tools mySQL语法错误

mdb-tools mySQL语法错误
EN

Stack Overflow用户
提问于 2013-10-25 00:22:47
回答 1查看 1.1K关注 0票数 0

我有一个要导出到mySQL数据库的.mdb文件。使用mdb-schema Data.mdb | mysql -u root -p Database时,我得到以下错误:

代码语言:javascript
复制
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的代码输出(实际上在管道之前是这样的) <>

代码语言:javascript
复制
  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

  • some other tables

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

提前感谢:)

EN

回答 1

Stack Overflow用户

发布于 2013-10-25 05:20:33

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

代码语言:javascript
复制
mdb-schema test.mdb mysql > output.txt

输出文件包含以下内容

代码语言:javascript
复制
-- ----------------------------------------------------------
-- 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语法。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19571385

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档