Feb
2
2016

Basic MySQL commands

While working on a simple data import from MySQL to MSSSQL, have to install MySQL as there is no workaround to import MySQL dump directly to SQL server, below are few commands used,

 

Note: There is no way you can EASILY import MySQL dump in .sql format directly to any other data source like MSSQL or Access DB, better to have MySQL installed locally and import MySQL dump there and then link it to other data sources.

 

Install MySQL: http://dev.mysql.com/doc/refman/5.7/en/windows-installation.html

 

  1. Export MySQL database backup (dump)

    Shell> mkdir DUMPDIR

    Shell> mysqldump –tab=DUMPDIR db_name

     

  2. Create a test MySQL database

    Shell> CREATE DATABASE test;

     

  3. Show list of databases present in MySQL

    Shell> SHOW Databases;

     

  4. Import a sqldump from flat file to new MySQL database ‘test’

    Shell> mysql -u root -p [db_name] < dump_file_name.sql

 

  1. Download MySQL ODBC connector for windows – to use with MS Access, SQL Server, etc.

    https://dev.mysql.com/downloads/connector/odbc/

     

  2. Create System DSN like below and connect with external sources – MS Access, SQL Server and import/link tables

     

 

 

References:

http://dev.mysql.com/doc/refman/5.7/en/creating-database.html

http://stackoverflow.com/questions/17666249/how-to-import-an-sql-file-using-the-command-line-in-mysql

https://thesqldev.wordpress.com/2014/07/02/importing-data-in-a-mysql-database-into-a-sql-server-database/

http://www.codeproject.com/Articles/29106/Migrate-MySQL-to-Microsoft-SQL-Server

http://www.experts-exchange.com/questions/28312991/MySQL-Dump-into-SQL-Server.html

http://serverfault.com/questions/317024/how-to-create-a-sql-server-database-from-a-mysqldump-file-automatically-on-a-dai

 

 

 

Download PDF

About the Author: Nitin G

Indian born, trekker, biker, photographer, lover of monsoons. I've been working full time with SQL Server since year 2005 and blogs to post the content aquired during my research on new topics or fixing issues faced by me as a DBA while working in different kind of projects, hope some of my posts may helps others in SQLDBA community. Everything you read on my blog is my own personal opinion and any code is provided "AS-IS" with no warranties!

Leave a comment

Subscribe to this blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 34 other subscribers

Translate this blog!

EnglishFrenchGermanItalianPortugueseRussianSpanish

Calender

December 2017
M T W T F S S
« Nov    
 123
45678910
11121314151617
18192021222324
25262728293031

View Post by Categories

%d bloggers like this: