UWP App to MySQL Connection Does Not Resolve Errors

Asked 1 years ago, Updated 1 years ago, 94 views

I am creating a C#UWP app in VS2019.

MySql.Data also has v8.0.22 installed on NuGet.

A simple example of connecting to a MySQL server running on the same network is created according to the tutorial, but the open() has failed and the cause is unknown.

The user privilege of the database to be connected has been configured, and the MySQL workbench, VS server explorer connection is successful from the terminal running the sample.Only my sample has an error.

MySQL Workbench, I am wondering if there is any port configuration because it can be connected with the server explorer.

I will paste the sauce extracted below.We have changed the database name (hoge) and account information (fuga/fuga) for your convenience.

//mysql test
string M_str_sqlcon="database=hoge; server=192.168.11.150; user id=fuga; password=fuga;";
MySqlConnection mysqlcon = new MySqlConnection(M_str_sqlcon);
MySqlCommand mysqlcom = new MySqlCommand("select*from mtr_ages", mysqlcon);
mysqlcon.Open();

Error:

MySql.Data.MySqlClient.MySqlException: 'Unable to connect to any of the specified MySQL hosts.'
AggregateException: One or more errors occurred. 192.168.11.150:3306)

I would appreciate it if you could send me a reply if you have any ideas for the cause or solution.Thank you for your cooperation.

c# mysql uwp

2022-09-30 17:09

1 Answers

I was told how to deal with it at the MSDN forum and solved it.After enabling private networks (clients and servers) in Package.appxmanifest, it was resolved.


2022-09-30 17:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.