locked
How to connect to MySQL Database on another server? RRS feed

  • Question

  • User-1385020226 posted

    Hello everybody, I have ASP.NET MVC C# Web Aplication ready, with MSSQL database, but I need to connect to MySQL Database on another server for some Clients information and display it on my website. How can I do this?

    I need at least any idia, because never done this.

    Is it better to copy this clients information to my database, because it is more then 3000 clients?

    How to mantain up to date copy of two databases?

    Thank you for your help.

    Sunday, June 3, 2018 10:23 PM

All replies

  • User1120430333 posted

    https://www.connectionstrings.com/mysql/

    There you have the MySQL connectionstrings

    Thursday, June 14, 2018 5:39 PM
  • User812858302 posted

    Hi DA,

    https://dba.stackexchange.com/questions/44758/create-a-trigger-to-update-table-data-on-another-servers-database

    look at this link this may give you some idea.

    Friday, August 10, 2018 7:45 AM
  • User-1320437544 posted

    Hello,

    First of you need to asure that if you are going to connect to the database of another server, this server is at your local area network (LAN) or you web app will do everything related with the database realy slow over the Internet.

    Second that the remote MySql server has remote access and permission granted so you can connect with your user/password combination without a problem.

    If those two conditions are met there is not much of a difference if you are connected to locahost MySql server machine or remote machine. Just set your connection string.

    And one more very important thing I forgot to mension make sure you have installed the MySql driver (Nuget) package and referenced it in your code (using System.Data,MySqlClient).

    If you refere to have a local copy of the database then you will go to totaly different dynamic where you will have to warry for keeping both MySql databases synced (replicated) in real time. Which required more profound mysql server administration and configuration knowledge.

    Saludos

    Wednesday, August 15, 2018 6:02 AM