我有一个要导出到mySQL数据库的.mdb文件。使用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 1mdb-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这实际上意味着语法错误在注释后的第一行?你能帮我解决这个问题吗?从蹩脚的眼睛看,它是有效的。
提前感谢:)
发布于 2013-10-25 05:20:33
根据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语法。
https://stackoverflow.com/questions/19571385
复制相似问题