Skip to content

ElusiveMind/mssql2mysql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

mssql2mysql

Simple MSSQL Server to MySQL table converter using PHP CLI. Originally based off the excellent starting work here.

Prerequisites

You will need to have the sqlserv driver for PHP PDO. I have done this on Ubuntu 22.04 and successfully used this script with PHP up to the latest release as of this writing which is PHP 8.3.

You can find instructions for installing this here. My work for this inside of a Docker container can be viewed HERE.

Usage

Edit the MSSQL and MySQL hostname, user, password, and database section. Run the script from command line using PHP CLI.

Example:

  1. Edit the file mssql2mysql.php using your favorite editor.

  2. Change MSSQL and MYSQL variables:

    define('MSSQL_HOST','mssql_host');
    define('MSSQL_USER','mssql_user');
    define('MSSQL_PASSWORD','mssql_password');
    define('MSSQL_DATABASE','mssql_database');
    
    define('MYSQL_HOST', 'mysql_host');
    define('MYSQL_USER', 'mysql_user');
    define('MYSQL_PASSWORD','mysql_password');
    define('MYSQL_DATABASE','mysql_database');
    
  3. Run the php script (make sure php is accessible in the path or environment variables)

php mssql2mysql.php

Limitations

Some of these limitations will be overcome in future versions of this script as it is under active development as of Oct 22, 2024. Pull requests and issue reports are welcome.

  • Just converts tables
  • No indexes
  • No store procedure
  • No triggers
  • No views
  • No Advanced MSSQL features

About

Simple MS SQL to MySQL PHP script converter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%