存档

‘MySQL’ 分类的存档

Convert MS SQL / Access to MySQL

2007年11月8日 admin 没有评论

Ref.: http://dev.mysql.com/tech-resources/art … osoft.html

Migration Tools

There are a wide variety of tools available to help you migrate a SQL Server or Access database to MySQL. We'll look at several different tools so you can choose the one that best suits your needs. The tools we will look at will include the following:

* MSSQL2MYSQL –> http://www.kofler.cc/mysql/mssql2mysql.txt
* Microsoft DTS
* SQLyog
* Access Export
* Text Import/Export

SQLYog and the Microsoft DTS wizard offer graphical interfaces that can be used with both MSSQL and Microsoft Access to import tables into MySQL. MSSQL2MYSQL is a script by Michael Kofler that can convert not only the table structure and data, but converts the index information as well. If you use Microsoft Access you may not have access to the above tools, but you can use the data export features of Access.

Text Import/Export

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

One final way to import data is to export the data from MSSQL/Access in a text format and import it directly into MySQL. When exporting, common formats such as tab-delimited or comma-delimited will work fine for later import into MySQL.

When taking this approach, you will need to manually create the MySQL tables, then import the data with the LOAD DATA command in the mysql command-line client. Additional information on the LOAD DATA command can be found in the “LOAD DATA INFILE syntax” section of the MySQL Reference Manual.

While perhaps the most labor-intensive and time-consuming, this approach gives you the highest level of control over table schema as you manually create the tables before importing data.

Example:

mysql> LOAD DATA INFILE '/var/www/npu_log/email_address.csv' INTO TABLE email_address fields terminated by ',';

Query OK, 31 rows affected, 31 warnings (0.00 sec)
Records: 31 Deleted: 0 Skipped: 0 Warnings: 31

分类: MySQL 标签: