gpt4 book ai didi

mysql - 将 .sql 文件导入 mysql(最终导入到 excel)

转载 作者:可可西里 更新时间:2023-11-01 10:42:44 26 4
gpt4 key购买 nike

所以我一直在尝试将 crunchbase 2013 快照(一个 mysql 转储文件)导入到 excel 中。我一直试图首先通过 mysql 命令行或 mysql worbench 6.3 将它导入数据库,但到目前为止我一直没有运气。 (在 Windows 上工作)

我的第一步是将所有文件合并到一个转储文件中。然后我尝试导入但出现此错误:

ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.

然后我尝试将其从 ANSI 转换为 UTF8 并重新打开。我收到与初始垃圾值相关的错误。我删除了它们,然后再次尝试导入。这是新错误:

ERROR 1064 (42000) at line 2: 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 '"cb_acquisitions" ( "id" bigint(20) NOT NULL, "acquisition_id" bigint(20) NO' at line 1

这是常规 .sql 文件的样子:

   Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app;     Mac OS X                2   „      ¶                                      ATTR       ¶   ˜                     ˜     com.apple.quarantine q/0001;52aa111a;Transmit.app; -- MySQL dump 10.13  Distrib 5.5.31, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: analytics_2
-- ------------------------------------------------------
-- Server version 5.0.51-log
/*!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,POSTGRESQL' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
--

--
-- Table structure for table "cb_acquisitions"
--

DROP TABLE IF EXISTS "cb_acquisitions";
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE "cb_acquisitions" (
"id" bigint(20) NOT NULL,
"acquisition_id" bigint(20) NOT NULL,
"acquiring_object_id" varchar(64) NOT NULL,
"acquired_object_id" varchar(64) NOT NULL,
"term_code" varchar(16) default NULL,
"price_amount" decimal(15,0) default NULL,
"price_currency_code" varchar(16) default NULL,
"acquired_at" date default NULL,
"source_url" varchar(255) default NULL,
"source_description" varchar(255) default NULL,
"created_at" datetime default NULL,
"updated_at" datetime default NULL,
PRIMARY KEY ("id"),
KEY "acquiring_object_id" ("acquiring_object_id"),
KEY "acquired_object_id" ("acquired_object_id"),
KEY "acquisition_id" ("acquisition_id")
);
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table "cb_acquisitions"
--

LOCK TABLES "cb_acquisitions" WRITE;
/*!40000 ALTER TABLE "cb_acquisitions" DISABLE KEYS */;
INSERT INTO "cb_acquisitions" VALUES (1,1,'c:11','c:10',NULL,20000000,'USD','2007-05-30','http://venturebeat.com/2007/05/30/fox-interactive-confirms-purchase-of-photobucket-and-flektor/','Fox Interactive confirms purchase of Photobucket and Flektor','2007-05-31 22:19:54','2008-05-21 19:23:44'),(2,7,'c:59','c:72','cash',60000000,'USD','2007-07-01','http://www.techcrunch.com/2007/07/02/dea

最佳答案

我设法让它与 mysql 命令行一起运行:

    mysql -u root -p --binary-mode=1
mysql> use dbname;
mysql> source /path/of/file/name.sql

关于mysql - 将 .sql 文件导入 mysql(最终导入到 excel),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42802680/

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