mysql - PhpMyAdmin 表导出忽略时间戳列
问题描述
我最近注意到,在导出带有 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;
生成的导出 INSERT 语句
--
-- Dumping data for table `req_status`
--
INSERT INTO `req_status` (`req_id`, `stat_id`) VALUES
(1, 5),
(2, 5);
解决方案
这在使用 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]
推荐阅读
- java - 退出方法/进程而不调用 exit() 方法
- r - 在 Rstudio 中保存 R 脚本
- node.js - 如何修复 Windows 10 中的“rimraf 不是可识别的命令”
- c# - 如何将 CanvasBitmap.CreateFromBytes 与来自 jpg 图像的字节 [] 一起使用
- android - “Xbox Button”的 Android keyEvent 键码
- c# - 如何将动态格式传递给 C# 6 插值字符串
- android - 使用智能阴影和半透明状态栏实现 Gmail 应用程序等工具栏
- url - 如何使用域名而不是 https://storage.googleapis.com/example.com/index.html 访问 Google 静态站点
- css - 有没有办法在没有 NodeJS 的情况下将 SASS 编译为 CSS?
- ide - 如何在打开大括号样式后使用 COMPACTED Allman 同一行的 PhpStorm 设置