简体   繁体   English

不同服务器上的相同数据库

[英]Same databases on different servers

Maybe the title of this question isn't very helpful or might be off topic... I have created mySQL database which has the same name and the same table as the mySQL database I was given by the server where I'm hosting my app. 也许这个问题的标题不是很有帮助,或者可能不在主题...我创建了mySQL数据库,它与mySQL数据库具有相同的名称和相同的表我是由我托管我的应用程序的服务器给出的。
In my Asp.net project I use my database and use Entity Framework. 在我的Asp.net项目中,我使用我的数据库并使用Entity Framework。

So with two different tables that have the same names and same tables it's just the connString(or is it?), my question would be, how do I let my website know that he should use the database on this server? 所以有两个不同的表具有相同的名称和相同的表,它只是connString(或者是它?),我的问题是,如何让我的网站知道他应该在这台服务器上使用数据库?

I asked the support of my host for help their reply was:"Sorry we have no experience in Your framework"!! 我请求主人的支持,他们的答复是:“抱歉,我们没有你的框架经验”!!

So this is where I have to turn for help. 所以这是我必须寻求帮助的地方。

EDIT: 编辑:

 <add name="tuuletfi_tidmediacafeEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;password=aleksalukic;database=tuuletfi_tidmediacafe&quot;" providerName="System.Data.EntityClient" />  

this is my entire connection string for the VS2015 这是我VS2015的整个连接字符串
Also I access the server DB with phpMyAdmin. 我也用phpMyAdmin访问服务器数据库。

You have to set the ConnectionString on your Web.Config: 您必须在Web.Config上设置ConnectionString:

https://msdn.microsoft.com/en-us/library/jj556606(v=vs.113).aspx https://msdn.microsoft.com/en-us/library/jj556606(v=vs.113).aspx

Has you try with a connection string like this 你试过像这样的连接字符串吗?

UPDATE this is extract from my webconfig pls check MYSQL driver version compliant with yours 更新这是从我的webconfig中提取的请检查与您的MYSQL驱动程序版本兼容

  <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />

<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider></providers>

<add name="mysql" connectionString="server=x.x.x.x;User Id=root;password=123456;database=appdb;pooling=false;" providerName="MySql.Data.MySqlClient" />

... before and of configuration ......之前和配置

<system.data>
<DbProviderFactories>
  <remove invariant="MySql.Data.MySqlClient" />
  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>

Change db/usr/pass with your data 使用您的数据更改db / usr / pass

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 同时在不同服务器上创建具有相同结构的数据库 - Create databases with same structure on different servers simultaneously 在同一事务中将事务范围用于不同 SQL Server 和数据库的问题 - Problems using Transaction Scope with different SQL Servers and databases in the same transaction Silverlight,连接到不同服务器上的多个数据库 - Silverlight, connecting to multiple databases on different servers 连接来自不同数据库的表,SQL和C#中的服务器 - Join tables from different databases, servers in SQL and C# 从同一MVC应用程序查询不同的数据库 - Querying different databases from the same MVC application 从2个不同服务器上的2个不同数据库中获取数据,然后使用C#将它们加入 - Get data from 2 different databases on 2 different servers and join them using C# 在具有不同connectionStrings的两台不同服务器上部署同一Web应用程序? - Deploying same web application on two different servers with different connectionStrings? C#项目具有不同的数据库,以不同的格式存储相同的数据 - C# project with different databases, storing same data in different formats 如何将相同的值添加到不同数据库中的不同表中 - How can i add the same value in to the different tables that are in different databases 需要在来自不同服务器Postgresql数据库的两个表之间同步数据 - Need to sync data between two tables from different servers Postgresql databases
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM