Today, I want to use Ruby on Rails to build a small project. I need to use the MySQL database. The data in the project already exists, but is saved in SQL Server. I can use rails to operate SQL Server, however, I don't always feel like it works very well. I want to use it after conversion. There are many conversion methods on the Internet, through ODBC, through PHPProgram, Write SQLCodeI think it is better to use tools for conversion. First, I tried to use ODBC and found that SQL Server's export function does not support MySQL ODBC very well.
ODBC is divided into 32-bit and 64-bit. It starts with 32-bit. It cannot be displayed on win7 64-bit. You can choose to add it only after downloading the 64-bit version from the MySQL official website.
64-bit version:
Http://www.mysql.com/downloads/connector/odbc/
After clicking finish, you need to select your MySQL database Source
In this way, you can see it in ODBC.
Unfortunately, the data exported from SQL Server cannot be converted, and the architecture does not match.
No way, continue searching on the Internet and find a blog saying that mss2sql can be used for conversion. The result is successfully converted on win7 64-bit:
Reference: http://www.cnblogs.com/andrew-blog/archive/2011/12/03/ SQL _mss2sql.html
Mss2sql: http://files.cnblogs.com/andrew-blog/mss2sql.rar
Open the compressed package after the download
Run mss2sql
The default value is move to MySQL server directly. Select next.
Continue to the next step. Wait a moment.
This time, I need to connect to the MySQL server. I am local, so I chose local and enter your username and password.
Continue waiting for connection
Select the database to be converted in MS SQL
Click Next. If there is a database with the same name in MySQL, you will be asked to select the conversion method, which is
- Overwrite the entire database: overwrite the entire database
- Overwrite existing tables only: only existing tables are overwritten.
- Skip existing tables: Skips existing tables
- Merge: Merge
I only have an empty database in MySQL, so I chose the first item, covering the whole.
Select the table to be converted and add it to the conversion list. I need all the tables, so I chose add all
Then there is a period of waiting.
There is not much data in this table, and it takes a little longer, about 10 minutes. If the table is large, it may be faster to use a program for conversion. Thank you for your convenience.
The following figure shows the table after the conversion. The data in the table is OK and there is no problem with Chinese.
The operating environment for this article is:
Win7 64-bit, SQL Server 2008 Express, MySQL 3.23.49, Apache 1.3.33,