gpt4 book ai didi

MySQL导入问题

转载 作者:搜寻专家 更新时间:2023-10-30 22:34:33 25 4
gpt4 key购买 nike

我正在尝试将一个数据库从一个数据库导出到另一个数据库。我正在使用以下命令导出和导入:

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

我希望有人能给我指出正确的方向,在此先感谢。

附言

下面是导出创建的 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 @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;

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

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;

/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;

/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

/*!40111 SET @OLD_SQL_NOTES=@@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 */;

最佳答案

根据 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.

您正在尝试从 5.7 一步到 5.5。这可能会导致您的问题。

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

关于MySQL导入问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38930439/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com