SQLSERVER数据导入到MYSQL_MySQL
bitsCN.com
SQLSERVER数据导入到MYSQL
http://hi.baidu.com/luck001221/item/cb4462299f9ea79ab73263d2?qq-pf-to=pcqq.group
1、去mysql的官方下载一个odbc的驱动,因为MSsql一直没有集成mysql的驱动,这个玩意需要单独下载,并安装的。
http://dev.mysql.com/downloads/connector/odbc/5.1.html
我下载的是windows解压缩的包Without installer (unzip in C:/),没有选择安装的。绿色版比安装版本要好。点击install的一个bat文件。
2、如果安装成功,在ODBC数据源驱动里面有个选项,如下图:
3、点击上图的用户dsn,添加一个mysql的连接,前提是你有一个mysql的数据库。
双击之后出现下面的提示框:
啊,哈,成功了一半了。
4、如果是SQL server2000用DTS的话,就可以直接用了。关键步骤在下面
下面这个界面很熟悉了:
ok导入完成了。
当然也可以使用文件dsn,把连接串存成一个文件,然后导入的时候选择文件dsn,只要找到连接串的路径就可以了,不在赘述。。
5、如果你用的是SQL2005的ssis的话,有点恶心。在这里我在强调一下:
我十分讨厌sql2005里面的DTS。希望微软的人能看到。
这里面的dsn要手动写的,没有办法从odbc里面直接读取出来,这个功能很实用,不会让人产生很多的误解。但是在2k5里面却没有,非常费解,微软的家伙是干啥吃的。
别以为你已经成功了,点下一步,在点下一步,等死吧。
我操,只能选择-编写查询以指定要传输的数据。吐血了。。有200多个表啊。这tmd咋搞?
经过测试,文件dsn和系统dsn都没有选择所有的表。而如果选择文件dsn用连接字符串的方式报这个错误:
我十分讨厌SQL server2005的DTS功能,设计微软SQL Server 2005的工程师是个白痴。
我决定用2K了。
我有测试了一下2008,嗯。2008有这个功能,下图:
SQL Server 迁移数据到MySQL
http://www.cnblogs.com/gaizai/p/3237907.html
一、背景
由于项目开始时候使用的数据库是SQL Server,后来把存储的数据库调整为MySQL,所以需要把SQL Server的数据转移到MySQL;由于涉及的表比较多,所以想在MySQL中生成对应表并导入数据;
上网找了些资料,如:将ACCESS和MSSQL导入MYSQL中、MySQL Migration 实现 MSSQL 到 MySQL数据迁移,虽然不知道里面的做法是否可以成功转移,但是里面的过程比较复杂,没有去尝试,后来自己找到了方法,最重要就是简单和准确(暂时没发现明显的BUG),这里分享给大家。
二、转移数据
我使用了MySQL的Client的工具SQLyog,这个工具的安装很简单。安装完成之后点击需要导入的目标数据库,点击右键【Import】->【Import Extenal Data】;
(Figure1:Import)
选择【Start a new job】,点击【下一步】;
(Figure2:Start a new job)
下面就是DSN的设置界面,如果你的下来列表中没有需要导出SQL Server数据库的DSN,那么需要通过【Create a New DSN】来创建一个新的DSN连接到SQL Sever;
(Figure3:Create a New DSN)
(Figure4:创建新数据源)
(Figure5:选择数据源类型)
把上面的设置保存为一个local.dsn文件;
(Figure6:选择数据源保存路径)
(Figure7:选择SQL Server服务器)
(Figure8:设置SQL Server帐号和密码)
(Figure9:选择SQL Server数据库)
(Figure10:测试数据源)
(Figure11:测试成功)
选中【File DSN】,在浏览中选择我们刚刚创建好的DSN,接着填写登录到SQL Server的帐号和密码;
(Figure12:选择DSN)
下一步,选择目标MySQL服务器,填写IP地址和帐号密码,并且需要选择目标数据库;
(Figure13:设置MySQL帐号和密码目标数据库)
这一步类似SQL Server的导入导出功能,这里可以拷贝一个表或者使用SQL脚本过滤数据;
(Figure14:表拷贝)
上面的全部过程就是为创建SQL Server与MySQL的一个管道,接下来就是最为重要的设置SQL Server表与MySQL表之间的对应关系了;里面包括了SQL Server表字段与MySQL表字段之间的对应关系【Map】,高级选项【Advanced】,过滤【WHERE】。
(Figure15:选择表对应关系)
下图Figure16,数据源【Source】,描述【Destination】,特别注意这里数据类型【Type】,这里的意思是转换目标的数据类型,但是不需要跟目标表的一样,因为这里是做为一个临时存储的数据类型,类似FindOn在SQL Server中是datetime,这里转换为MySQL的timestamp,其实MySQL目标表的数据类型是datetime,这样的设置也是可以转换成功的。
(Figure16:表字段转换)
(Figure17:高级选项)
(Figure18:Error)
(Figure19:Log)
(Figure20:执行信息)
(Figure21:执行结果)
(Figure22:原始SQL Server的数据列表)
(Figure23:转移到MySQL的数据列表)
对比下Figure20与Figure21,发现我们数据已经全部转移成功了;
bitsCN.com
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

MySQL has a free community version and a paid enterprise version. The community version can be used and modified for free, but the support is limited and is suitable for applications with low stability requirements and strong technical capabilities. The Enterprise Edition provides comprehensive commercial support for applications that require a stable, reliable, high-performance database and willing to pay for support. Factors considered when choosing a version include application criticality, budgeting, and technical skills. There is no perfect option, only the most suitable option, and you need to choose carefully according to the specific situation.

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.

1. Use the correct index to speed up data retrieval by reducing the amount of data scanned select*frommployeeswherelast_name='smith'; if you look up a column of a table multiple times, create an index for that column. If you or your app needs data from multiple columns according to the criteria, create a composite index 2. Avoid select * only those required columns, if you select all unwanted columns, this will only consume more server memory and cause the server to slow down at high load or frequency times For example, your table contains columns such as created_at and updated_at and timestamps, and then avoid selecting * because they do not require inefficient query se

To fill in the MySQL username and password: 1. Determine the username and password; 2. Connect to the database; 3. Use the username and password to execute queries and commands.

MySQL database performance optimization guide In resource-intensive applications, MySQL database plays a crucial role and is responsible for managing massive transactions. However, as the scale of application expands, database performance bottlenecks often become a constraint. This article will explore a series of effective MySQL performance optimization strategies to ensure that your application remains efficient and responsive under high loads. We will combine actual cases to explain in-depth key technologies such as indexing, query optimization, database design and caching. 1. Database architecture design and optimized database architecture is the cornerstone of MySQL performance optimization. Here are some core principles: Selecting the right data type and selecting the smallest data type that meets the needs can not only save storage space, but also improve data processing speed.

Copy and paste in MySQL includes the following steps: select the data, copy with Ctrl C (Windows) or Cmd C (Mac); right-click at the target location, select Paste or use Ctrl V (Windows) or Cmd V (Mac); the copied data is inserted into the target location, or replace existing data (depending on whether the data already exists at the target location).

Detailed explanation of database ACID attributes ACID attributes are a set of rules to ensure the reliability and consistency of database transactions. They define how database systems handle transactions, and ensure data integrity and accuracy even in case of system crashes, power interruptions, or multiple users concurrent access. ACID Attribute Overview Atomicity: A transaction is regarded as an indivisible unit. Any part fails, the entire transaction is rolled back, and the database does not retain any changes. For example, if a bank transfer is deducted from one account but not increased to another, the entire operation is revoked. begintransaction; updateaccountssetbalance=balance-100wh
