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.
Related
Please forgive me if the title is not correct. I am still trying to understand how this works.
I have installed MySQL workbench and the MySQL server on my laptop. I have successfully created a database that store driver details, as per the picture.
I can access this info only one my laptop. However, I would also like to access this info from other PC's. I was thinking of having the main database in a secured room and then connecting about 3 additional PCs to the main database.
I have also written a simple c# script on Visual Studio that runs on my main laptop where the database is stored. This script just allows a user to enter his username and password and then displays the contains of the database (the table in the database) on a datagrid view. I have included the SQL injection code to prevent unwanted characters. This application also allows the user to insert, update, and delete info from the database provided the user that logs in has these privileges granted.
Now I would also like to run this application on the other 3 PC's, but obviously I have a problem. This problem is these PC's cannot access the main database. The main database user has privileges that allow him to alter the database but the other uses that are located in the access points to do not have this privilege. All they can do it enter their username and password and see the data from the database been displayed on the datagrid view.
So my question is how do I grant access to these other three PC's to access the main database?
MySQL Workbench and MySQL server is so far only installed on my laptop and not on the other 3 PC's.
Database users
Error message
The entire point of database technology is to allow multiple clients to access the same server and share the same data. (Actually there's another point: the ability to handle vast amounts of data. But that's not your problem right now.)
Here's what you need to do.
Get MySQL server software set up on a server in your server room. Find out the hostname of that server.
Log in to that server using MySQL Workbench. It asks you for the hostname.
Use Workbench to migrate your data from your localhost MySQL server to the one in the server room. Workbench has decent features to help you do that.
Create a mysql account on the shared server that just has access to the database you just created. Keep in mind that MySQL users look like this: 'david'#'localhost' or 'david'#'*' or 'mickey'#'*.animation.disney.com'. That is, they specify both the username and the machine the user runs on.
Change your C# connection string to mention the shared server's hostname and the account you just created.
myConnectionString = "server=shared.example.com;uid=root;pwd=12345;database=test";
Somehow tell the other users of your app to use this connection string.
There's another, simpler but less robust, way to do all this. Make sure your laptop has its own hostname. I dunno, david.example.com maybe? Ask your local LAN or VPN administrator. Or just use your laptop's IP address in place of a hostname. Then put that hostname into your connection string. Then other users of your application can hit the MySQL server on your laptop. But, if you switch off your laptop and take it home they'll lose access.
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.
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'";
I have a very unusual problem. I made a project in C#.net in vs 2008 and SQL server 2005.
I have two DB to use.
Now, the problem is whenrunning the project on my PC it works fine, but when i install on users PC, through setup, im getting a exception handler error , when im trying to save any data in either of the DBs. However i tried to insert data through INSERT INTO coomand in sql it works fine. And i have no problem in retrieving data.
So any one can help please do.
Thanks in advance
How are you specifying your connection to the database(s)? If you're doing windows authentication, most likely your user's accounts don't have permissions on the database. It could also be that they can't see the database from where they are on the network.
I'd start by pinging the DB server from the user's machine to make sure they can even access the server.
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.