Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

HTML
<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" />


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:

HTML
<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" />


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?
Posted
Updated 1-Aug-13 2:57am
v2
Comments
ZurdoDev 1-Aug-13 9:01am    
A quick google search indicates that some have used http://www.dbload.com/ to do this.

1 solution

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:
XML
<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:
C#
using (MySqlConnection dbConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString))
{
    // Database work done here
}
 
Share this answer
 
v2
Comments
Mobile.Instinct 1-Aug-13 10:13am    
Thanks. I do have the migration tool kit already available, I am just not sure how do I target the application to my MS SQL database that I am using to convert to MySQL database. I am getting errors on connecting to the MS SQL database.
Kuthuparakkal 2-Aug-13 2:07am    
Did you install MySQL.Net Connector ?
If not install it from http://dev.mysql.com/downloads/connector/net
Mobile.Instinct 2-Aug-13 4:42am    
Yup I have that installed on my system. I am just not aware of what to put in as the connection string values for my MS SQL server in order to point it to the database that I am using in my application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900