简体   繁体   中英

How to convert MySQL dump to SQL Server format

I have downloaded a SQL dump of wikimedia

It has below information

I do not want to install any MySQL server and just want to convert this code so that I can import to SQL Server 2019

    -- MySQL dump 10.16  Distrib 10.1.38-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 10.64.32.116    Database: enwiktionary
-- ------------------------------------------------------
-- Server version   10.1.43-MariaDB

/*!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 utf8mb4 */;
/*!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 `category`
--

DROP TABLE IF EXISTS `category`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `category` (
  `cat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cat_title` varbinary(255) NOT NULL DEFAULT '',
  `cat_pages` int(11) NOT NULL DEFAULT '0',
  `cat_subcats` int(11) NOT NULL DEFAULT '0',
  `cat_files` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`cat_id`),
  UNIQUE KEY `cat_title` (`cat_title`),
  KEY `cat_pages` (`cat_pages`)
) ENGINE=InnoDB AUTO_INCREMENT=50325885 DEFAULT CHARSET=binary ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `category`
--

/*!40000 ALTER TABLE `category` DISABLE KEYS */;
INSERT INTO `category` VALUES (1,'Italian_verb_forms',318746,3,0),(3,'English_adjectives',131200,8,0),(4,'Mycology',101,101,0),(5,'English_verbs',41925,23,0),(7,'English_nouns',338181,19,0),(11,'Candidates_for_speedy_deletion',10,2,0),(13,'Translation_requests_(Hungarian)',0,0,0),(14,'Translation_requests_(Korean)',0,0,0),(15,'Translation_requests_(Polish)',0,0,0),(16,'Translation_requests_(Slovak)',0,0,0),(17,'Translation_requ

Try

SQL Server Migration Assistant

https://docs.microsoft.com/en-us/sql/ssma/sql-server-migration-assistant?view=sql-server-ver15&viewFallbackFrom=sql-server-2019

You need an mysql odbc driver for that (of course), because you have to connect both servers.

You can try mysqldump

mysqldump --compatible=mssql

But that doesn't work everytime, and if that sql is to big you can get problems. the rest -u and -p you should know waht you have to add evntually you need also --extended-insert=FALSE

Also phpmyadmin has an option to make an Backup in mssql Format, for that you switch to sql compatibility, but you need a websever plus pho for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM