将MS SQL数据库表复制到MySQL数据库 [英] Copy MS SQL database tables to MySQL database

查看:80
本文介绍了将MS SQL数据库表复制到MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我对Web开发和服务器支持数据库都很陌生。基本上,我使用的是我在网上找到的用于创建帐户,登录等的示例项目。该项目使用数据库将所有这些信息存储在MS SQL服务器上(据我所知)并使用以下连接字符串:< br $> b $ b

Hello,

I am quite new to web development and databases on server support. Basically, I am using a sample project that I found online for creating accounts, logging in etc. The project uses a database that stores all this information on an MS SQL server (as far as I know) and uses the following connection string:

<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated 

Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"

		  providerName="System.Data.SqlClient" />
		<add name="aspnetdbConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|

DataDirectory|\aspnetdb.mdf;Integrated Security=True;User Instance=True"

		  providerName="System.Data.SqlClient" />





现在所有这些信息都存储在此aspnet.mdf数据库包含所有包含适当值的表。这一切都在本地使用localhost工作正常。现在,我的下一个目标是在我的服务器上获取它,我可以获得正常的功能,但数据库部分。数据库,服务器使用的是一个MySQL数据库。我创建了一个测试数据库并拥有了这个数据库降低连接字符串如下:





Now currently all this information is stored in this aspnet.mdf database with all the tables containing the appropriate values. This all works fine locally using localhost. Now, my next target is to get it on my server and I can get the normal functionality working but the database part. The database that the server uses is a "MySQL" database. I have created a test database and has the following connection string given below:

<add name="ApplicationServices" connectionString="Database=test;Data Source=192.168.1.2;User 

Id=root;Password=password"

		  providerName="MySql.Data.MySqlClient" />
		<add name="aspnetdbConnectionString" connectionString="Database=test;Data Source=192.168.1.2;User 

Id=root;Password=password"

		  providerName="MySql.Data.MySqlClient" />





我可以使用上面的连接字符串连接到数据库,但是我想从以前的数据库中获取所有表和信息到我的新MySQL数据库,因为当我尝试登录时,它无法连接到之前访问的表。有人能建议我这么简单吗?通常或通过visual studio?



I can connect to the database using the above connection string, but I would like to get all the tables and information from the previous database to my new MySQL database because when I try to login it cannot connect to the tables that it was accessing before. Could anyone suggest me an easy way to do this? Either normally or via visual studio?

推荐答案

尝试MySQL迁移工具包:

http://downloads.mysql.com/archives.php?p=mysql-migration-toolkit [ ^ ]

同时验证移动原因请阅读以下文章:

http://dev.mysql.com/tech -resources / articles / move_from_microsoft_SQL_Server.html [ ^ ]

检查你的连接字符串:

Try MySQL migration Tool Kit:
http://downloads.mysql.com/archives.php?p=mysql-migration-toolkit[^]
Also validate why to move frpm the article below:
http://dev.mysql.com/tech-resources/articles/move_from_microsoft_SQL_Server.html[^]
Check your connection string:
<add name="connstring" connectionString="server=192.168.1.2;User Id=root;Persist Security Info=True;database=test;password=password" providerName="MySql.Data.MySqlClient"/>



然后您的代码应如下所示:


Then your code should look like:

using (MySqlConnection dbConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString))
{
    // Database work done here
}


这篇关于将MS SQL数据库表复制到MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆