Connect to a local MySQL Router from another computer - c#

I am currently about to undergo a programming project that requires me to have access of data on a table in a MySQL schema that is on my desktop. I am trying to connect to this schema from visual studio on my laptop.
What I am trying to do is link the two so I will be able to access the data on the table on the MySQL schema. Is this possible over two computers? And if the link is made, will I be able to work with the database while I am at school? If it would work how would I do it?
I am currently a COMPLETE novice at MySQL, I only started to learn it last night. However I am ok at C# on visual studio.

It's as easy as connecting it in your laptop.all you need to do is allow port access in the firewall.in you connection string add ip address or computer name.of the host server as your host.
Something like this.
"Datasource='192.168.1.1';port ='3306'; database='mydb';username='root';password='123'";

Related

Connecting Visual Studio to MySql database with ssl certificate

I will try to explain the problem best as I can.
My goal:
Connecting Visual Studio (Windows Form Application in c#) to MySql database witch uses ssl. I am using MySql Database option in Data source configuration wizard.
What I have:
Code that works on local database.
Two files, client-‘name’.key and client-‘name’.crt witch is a key and certificate for ssl
I also have username, password, port and database to witch I managed to connect from MySql workbench. So I am sure everything works fine and I am just unable to connect from the app itself.
Things I learned so far:
I know that in order to do so I must use data wizard (or connection string builder) but I have to play with advanced settings. Witch I did with no success.
I have entered information such as username, port, password and database but I dont know how to include ssl information witch I guess is essential.
I hope that you understand my issue and that you will be able to resolve it.
Thanks in advance.
I tried making a connection on my own but I have never connected to remote server and have no experience doing so.

Accessing an SQL Server remotely with a C# / Android app client

I am a programmer enthusiast who recently made his first C# and an Android Studio client that uses an “Microsoft SQL Server Management Studio v18.8” database with multiple tables.
Before doing this I had no knowing in SQL programming. My goal is to give the C# client to multiple users and with the Android Studio to verify a final table instruction ( Everything works fine if the devices are in the same network area. example. C# and Android app connected on the same Wi-Fi )
If I switch off the wi-fi on my cellphone and connect it to mobile network I cannot access the database anymore. Upon searching for more information I found out that I need to configure my router for IP-Forwarding with the PORT which is configured in the SQL Server Configuration Manager. ( I edited the exception rules in Firewall setting to allow connections for that port ) Since I am new, my questions are:
Is IP-Forwarding a viable solution for accessing remotely over the internet? Upon searching I understood that it isn’t and my confusion is “How does somebody else access an SQL database remotely ( over the internet ) ?”
Moreover, is accessing remotely over the internet an SQL db viable? If not, what would be the correct approach for a client to INSERT/SELECT something in a SQL server which is located on another network that has an open connection with the internet?
On both clients the string connection is made by giving the server’s IP / PORT, database and Login Credentials. Is there a way to hard code the Password Credential? So that it won’t be a string variable, vulnerable to hacking?
For me is a challenge and I find it fascinating how fun is to manipulate the SQL data and the fact that it works is super impressive.
My 4th question will be off topic, but learning/writing the programs I start thinking: Is an API and an SQL database related somehow? Or at least they work on the same principle?( I have no deep knowledge of what an API is, just basic understanding ) Is this what back-end programming means?

Using C# application with Mysql Database on Another Computer

I have made a C# application MySql Database attached I am going to use the Application on a different Computer. According to my Logic. The Mysql database is running on the localhost server of my first PC and I think that the localhost of the other PC will be different. So,My application Won't connect to the server - It's my Idea which may be wrong.
I have the following Questions :-
1.
How do I make a Mysql local server that will even work on another PC.
2.
Do I have to Install MySql on other PC ? If yes How can i include mysql setup in the Setup Wizard of my app.
3.
Do I have to make changes In the Code (Connection or anything).
Please Give any extra suggestion if you have about this.
You do not need to install mySQL on the computer that will have the app. that defeats the purpose of having a SQL Server
You will only need to change the connection string so instead of connecting to Localhost or 127.0.0.1 you will use the ip address of the machine that has the server installed. Connection Strings
I suggest you do some reading about networking, design patterns, and SQL or you risk building a very insecure application.

MySQL and Windows Store C# application

I've been searching about this on Google and I did find some useful stuff but I'm not totally sure if that's what I need so I'll ask here.
I'm trying to make a Windows Store application and I want to connect to a simple MySQL database that's on the server. What's the easiest or best way to do that? Whenever I need local databases I use Entity Framework. Is it possible to use it here and if so, are there any tutorials that cover everything that I need to install as well as some code examples?
My advice for you : read more about Database Engine :) cause once you connect you DB Engine to a Database : either it is local or on remote machine (Server) its the same thing when you look at it from your application.
1- First watch this read more about this : SQL Server Management Studio
2- watch this (how you connect to a remote database) enter link description here
3- Very important is to allow connection from Remote Machine enter link description here
4- Once you are able to connect to the remote database from your SQL Server, everythg is the same on EF.

Connection to MYSQL from visual c#

I'm not sure if this is the right place for this question, but here goes......I have a website that was developed in PHP using MYSQL. Now, I am wanting to write an application in Visual C# which accesses the MYSQL database, and returns data from that database to the application. I attempted this, and received the error "(xx.xxx.xxx.xx) is not allowed to connect to this MYSQL server". After some research, I found that there was a way to turn this off on the server by IP address. However, this application would eventually be distributed to other people and PC's, so I don't think this is a permanent solution. I think I could open the MYSQL database to the world, but I'm hoping for some way that I can connect to MYSQL and tell the server that I am coming from the hello world application only. Does anyone know if this is possible from Visual C# and MYSQL, or know of a secure way to connect to a remote website MYSQL database using an application that can have a dynamic IP address?
Thanks in advance!
Ramhound is right in that you need to reconfigure your server if you want to do anything like this, but if you want to connect to the server directly from the client applications, your client would need to have the password for your Mysql which is not ideal..
Instead you should set up a webservice on your database server, and use that to sent/receive data to and from the clients.

Categories