2016-08-13 4 views
1

データベース間でデータベースをエクスポートしようとしています。私は、エクスポートおよびインポートするには、次のコマンドを使用しています:私は、チェックし、元のデータベースを使用して作成されて明らかになったMySQLインポートの問題

export: mysqldump -u root -p dwad dwadallauth.sql 
import: $ mysql -u root -p dwad < dwadallauth.sql 

次のように

CREATE DATABASE dwad CHARACTER SET utf8 COLLATE utf8_general_ci; 

、その後、権限が付与された:

GRANT ALL PRIVILEGES ON dwad.* TO 'dwad'@'localhost' IDENTIFIED BY '9LSo1SxqdJF45PL'; 

だから私は、次のインポートを試してみました:

import: $ mysql -u root -p --default-character-set=utf8 dwad < dwadallauth.sql 

私はインポートしようとしたときにしかし、私は次のエラーを取得する:

ERROR 1064 (42000) at line 54: 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 '(6) NOT NULL, 
    `sent` datetime(6) DEFAULT NULL, 
    `key` varchar(64) NOT NULL, 
' at line 3 

私がチェックしていると、次のようにMySQLのバージョンは以下のとおりです。

Export: mysql Ver 14.14 Distrib 5.7.13, for Linux (armv7l) using EditLine wrapper 

Import: mysql Ver 14.14 Distrib 5.5.50, for debian-linux-gnu (x86_64) using readline 6.3 

私は誰かが私を指すことができるかもしれ願っています正しい方向で、事前に多くの感謝。

PS

以下

は、輸出によって作成されたSQLファイルのコピーです:

-- MySQL dump 10.13 Distrib 5.7.13, for Linux (armv7l) 
-- 
-- Host: localhost Database: dwad 
-- ------------------------------------------------------ 
-- Server version  5.7.13-0ubuntu0.16.04.2 

/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */; 

/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */; 

/*!40101 SET @[email protected]@COLLATION_CONNECTION */; 
/*!40101 SET NAMES utf8 */; 

/*!40103 SET @[email protected]@TIME_ZONE */; 

/*!40103 SET TIME_ZONE='+00:00' */; 

/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 

/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 

/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 

/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */; 

-- 
-- Table structure for table `account_emailaddress` 
-- 

DROP TABLE IF EXISTS `account_emailaddress`; 
/*!40101 SET @saved_cs_client  = @@character_set_client */; 
/*!40101 SET character_set_client = utf8 */; 
CREATE TABLE `account_emailaddress` (
    `id` int(11) NOT NULL AUTO_INCREMENT, 
    `email` varchar(254) NOT NULL, 
    `verified` tinyint(1) NOT NULL, 
    `primary` tinyint(1) NOT NULL, 
    `user_id` int(11) NOT NULL, 
    PRIMARY KEY (`id`), 
    UNIQUE KEY `email` (`email`), 
    KEY `account_emailaddress_user_id_2c513194_fk_auth_user_id` (`user_id`), 
    CONSTRAINT `account_emailaddress_user_id_2c513194_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) 
) ENGINE=InnoDB DEFAULT CHARSET=latin1; 
/*!40101 SET character_set_client = @saved_cs_client */; 

-- 
-- Dumping data for table `account_emailaddress` 
-- 

LOCK TABLES `account_emailaddress` WRITE; 
/*!40000 ALTER TABLE `account_emailaddress` DISABLE KEYS */; 
/*!40000 ALTER TABLE `account_emailaddress` ENABLE KEYS */; 
UNLOCK TABLES; 

-- 
-- Table structure for table `account_emailconfirmation` 
-- 

DROP TABLE IF EXISTS `account_emailconfirmation`; 
/*!40101 SET @saved_cs_client  = @@character_set_client */; 
/*!40101 SET character_set_client = utf8 */; 
CREATE TABLE `account_emailconfirmation` (
    `id` int(11) NOT NULL AUTO_INCREMENT, 
    `created` datetime(6) NOT NULL, 
    `sent` datetime(6) DEFAULT NULL, 
    `key` varchar(64) NOT NULL, 
    `email_address_id` int(11) NOT NULL, 
    PRIMARY KEY (`id`), 
    UNIQUE KEY `key` (`key`), 
    KEY `account_ema_email_address_id_5b7f8c58_fk_account_emailaddress_id` (`email_address_id`), 
    CONSTRAINT `account_ema_email_address_id_5b7f8c58_fk_account_emailaddress_id` FOREIGN KEY (`email_address_id`) REFERENCES `account_emailaddress` (`id`) 
) ENGINE=InnoDB DEFAULT CHARSET=latin1; 
/*!40101 SET character_set_client = @saved_cs_client */; 

答えて

1

のMySQL 5.7のマニュアルによると:

Downgrading more than one release level is supported using the logical downgrade method, but only if you downgrade one release level at a time. For example, you can downgrade from 5.7 to 5.6, and then to 5.5.

あなたがから行くしようとしています1ステップで5.7〜5.5。これは問題を引き起こしている可能性があります。

https://dev.mysql.com/doc/refman/5.7/en/downgrading.html

+0

バージョン5.6にアップグレードしても問題なく動作しました。多くのおかげで、アラン。 –

1

datetime(6)を参照してくださいは、古いバージョンではサポートされていません。ダウングレード中にマイクロ秒を失う必要があります。

+0

明確化 - 「FRAC_SECOND」(多くの制限付き)は、5.5.3まで存在し、それは「MICROSECOND」に変更されました。 5.6.4 TIME、DATETIME、TIMESTAMPにおける分数秒(マイクロ秒)のサポート。 –