Quantcast
Channel: Ramblings of a SQL DBA mind… by Nitin Garg
Viewing all articles
Browse latest Browse all 34

Basic MySQL commands

$
0
0

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

Viewing all articles
Browse latest Browse all 34

Trending Articles