Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Cant connect to MySql database from another computer

$
0
0

I have made a simple database on MySql and am accessing it on a visual c++ GUI using the following code for example:

String^ constring=L"datasource=192.168.0.7;port=3307;username=billet;password=root";
MySqlConnection^ conDataBase=gcnew MySqlConnection(constring);
MySqlCommand^ cmdDataBase= gcnew MySqlCommand("select * from database.materials ;", conDataBase);
MySqlDataReader^ myReader;

This runs fine on the computer on which I have MySql installed and am running the code from however when I send the app to other computers which do not have MySql and run the code a little padlock symbol appears on the bottom left of my desktop icon for the app and when I run it I get a couple second delay and then a message appears saying "program has stopped working" and has a loading bar underneath it (same as when something crash's). 

Notes: I am trying to run this app on another computer which is currently using the same wireless connection as the laptop I made it on, the computer it is being run on does not have MySql installed on it. I have also tried to stop all of my firewalls but I still get the same error.

The code shown above is a modification of the original, initially I was accessing a localhost however since I needed remote access I went into MySql users and privileges and created a new user account called billet and set its host matching to % and set schema privileges to access the database in my localhost, this still gives the same problem.  




Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>