从localhost导出到同一LAN上的远程

时间:2017-03-12 09:46:08

标签: mysql phpmyadmin

我想将我的一个数据库导出到我的Raspberry。我尝试了PHPMyadmin,但在导入时我得到了这个错误消息:

SQL query:

--
-- Database: `leltar`
--

-- --------------------------------------------------------

--
-- Table structure for table `eventlog`
--

CREATE TABLE `eventlog` (
  `ID` int(50) NOT NULL,
  `event` varchar(50) COLLATE utf8_hungarian_ci NOT NULL,
  `productbc` varchar(50) COLLATE utf8_hungarian_ci DEFAULT NULL,
  `uname` varchar(50) COLLATE utf8_hungarian_ci NOT NULL,
  `datetime` datetime(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci;

MySQL said: Documentation
#1064 - 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 '(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci' at line 16 

问题是什么?

3 个答案:

答案 0 :(得分:3)

您的日期时间字段已指定fractional secondsdatetime(1)

目标mysql版本(< v5.7)可能不支持此功能,因此出现错误消息。

您需要升级目标mysql版本以支持小数秒,或者您需要从数据定义和数据本身中删除导出文件中的小数秒。

答案 1 :(得分:1)

downloadCount

答案 2 :(得分:0)

删除"(1)"在" datetime"之后因为它不需要长度(对不起,它不是"长度"它是小数秒规格)。以下应该有效:

CREATE TABLE `eventlog` (
  `ID` int(50) NOT NULL,
  `event` varchar(50) COLLATE utf8_hungarian_ci NOT NULL,
  `productbc` varchar(50) COLLATE utf8_hungarian_ci DEFAULT NULL,
  `uname` varchar(50) COLLATE utf8_hungarian_ci NOT NULL,
  `datetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci;
相关问题