Thursday 24 May 2012

Transferring a database from a .mdf file or from SQL Server to a new Mysql database.

Transferring a database from a .mdf file or from SQL Server to a new Mysql database.


I've been fighting with this issue for the last few hours.

We have a server that has been set up by someone else and what I need to do is import the tables  from this server onto my new server.

The easiest way would be to use phpmyadmin - however it neither seems to be installed and  installation on phpmyadmin would probably take hours as the server is VERY slow.  Which is one of  the reasons why I need to change to the new database.  Additional the server would probably need  extra things installed like GD to get phpmyadmin to work.

The next thing I tried to do was look to see if there where any files in SQL Server that are data files I  could grab and export into a new database.  The solution I found in the end is much simpler - and that  is because I already know the username and password for the database I could write a script that  would take the information off.

NO NEED TO WRITE THE SCRIPT as this blog has it for me  BACKUP mysql using PHP script

This script worked a treat - the only change is that you need to add the database name in the function arguements. ;)

No comments: