Home > Net >  Error database import from localhost to server
Error database import from localhost to server

Time:06-28

I want to upload database from localhost to server and I get 1067 error. Localhost Mysql version - 5.7 Server - MariaDB, v5.5.68

Code part

CREATE TABLE `wp_momopay_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `amount` int(10) unsigned DEFAULT '0',
  `phone_number` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `payment_id` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `failed_reason` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `salt` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `status` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Error message

ERROR 1067 (42000) at line 1721: Invalid default value for 'created'
program 'mysql' finished with non-zero exit code: 1

CodePudding user response:

Mariadb 5.5 only allows TIMESTAMP, not DATETIME, columns to have the CURRENT_TIMESTAMP default value. So your table definition uses a feature it lacks.

Mariadb 5.5 hit end-of-life on 11-April-2020, well over two years ago.

  • Related