【问题标题】:PhpMyAdmin Table Export ignores timestamp columnPhpMyAdmin 表导出忽略时间戳列
【发布时间】:2020-04-10 14:26:45
【问题描述】:

我最近注意到,在导出带有 TIMESTAMP 列的 MySQL 表时,在执行 Export 的 INSERT 语句部分时会忽略该列。可能是什么问题呢?下图:

生成的导出 CREATE TABLE 语句:

-- Table structure for table `req_status`
DROP TABLE IF EXISTS `req_status`;
CREATE TABLE `req_status` (
  `req_id` int(11) NOT NULL,
  `stat_id` int(11) NOT NULL,
  `change_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

生成的导出插入语句

--
-- Dumping data for table `req_status`
--

INSERT INTO `req_status` (`req_id`, `stat_id`) VALUES
(1, 5),
(2, 5);

【问题讨论】:

  • 您是否使用 phpMyAdmin 创建导出?您使用的是哪个 phpMyAdmin 版本?您是否更改了默认的任何导出设置?这对我来说很好,所以你的 phpMyAdmin 配置可能有一些情况。

标签: mysql linux apache phpmyadmin


【解决方案1】:

这是在使用 MySQL >= 8.0.13 时报告的错误。据说它已在 phpMyAdmin 5.0.1 中修复,但我正在使用该版本,但仍然有这个问题,所以我不太确定。

https://github.com/phpmyadmin/phpmyadmin/issues/15315

您可以使用 mysqldump 代替:

mysqldump -h [hostname] -u [user] -p [database-name] [tables] > [path-to-dump-file]

【讨论】:

    猜你喜欢
    • 2016-03-13
    • 1970-01-01
    • 2014-07-04
    • 1970-01-01
    • 2011-04-19
    • 2013-09-02
    • 2011-02-19
    • 2016-10-13
    • 2016-09-16
    相关资源
    最近更新 更多