Why c# app can't connect to MySql database on pythonAnywhere?

Created a MySql database on pythonAnyWhere. I need to connect to it via a c# application. But the connection fails, after 5-10 seconds it displays the error about the failed connection attempt, because time is up. What is the reason?
The code example.
using MySql.Data.MySqlClient;
private void butreg_Click(object sender, EventArgs e)
{
 string connStr = "server=User.mysql.pythonanywhere-services.com;user=User;database=User$DataBase;password="pass";
 MySqlConnection conn = new MySqlConnection(connStr);
 }

5cf52b5443f02613462189.png
conn.Open();
March 23rd 20 at 18:55
1 answer
March 23rd 20 at 18:57
MySQL databases on PythonAnywhere are protected by a firewall, so external computers can't access them.

However, if you have a paid account, you can access your MySQL database from outside using a technique called an SSH tunnel, which essentially makes a secure SSH connection to our systems, then sends the MySQL stuff over it.


If an application on your PC and have a paid account to use SSH tunnelling:
https://help.pythonanywhere.com/pages/AccessingMyS...

UPD:
If not for a paid account?

It is logical to use another hosting or to run DBMS on the car or still have a paid account.

I'll quote your response:
If you do not want to run the server in Russia, then I can recommend Hetzner Cloud (excellent ratio quality/price), the price starts from 2,99 Euro (in rubles is about 230, if Sberbank card to pay). If you have used less than a month, the payment will be considered hourly (0.005 Euros per hour)
And if not for a paid account? - chandler.Labadie commented on March 23rd 20 at 19:00
@chandler.Labadie, added response - vicenta42 commented on March 23rd 20 at 19:03
@vicenta42, there is still a question. Python Anywhere allows you to connect to a database on another hosting? - chandler.Labadie commented on March 23rd 20 at 19:06
@chandler.Labadie, if you use Hetzner, or any normal hosting, Python Anywhere, you will not need more. - vicenta42 commented on March 23rd 20 at 19:09
Still unable to explain. I'm hosting, which in ispmanager work created virtual environment, made the file passenger_wsgi.py filled everything in the folder domain, I what to do now? Services are provided by Fozzy
import sys
import os
INTERP = os.path.expanduser("/var/www/u0000005/data/flaskenv/bin/python")
if sys.executable != INTERP:
 os.execl(INTERP, INTERP, *sys.argv)

sys.path.append(os.getcwd())

from hello import application
- chandler.Labadie commented on March 23rd 20 at 19:12
@chandler.Labadie,
I'm hosting, which in ispmanager work created virtual environment, made the file passenger_wsgi.py filled everything in the folder domain, I what to do now?

I eight years ago, the last time I used ISP manager (then admin).
Deploy the application using gunicorn and supervisor.
Or in Docker. - vicenta42 commented on March 23rd 20 at 19:15
In General, I more or less understand how to work with it, but today I can do this quite late. Until what time I can to you to seek advice in case of what? - chandler.Labadie commented on March 23rd 20 at 19:18
@chandler.Labadie, thus there is already in the paid consultation questions will be typed.
What benefit to do it for the thanks? - vicenta42 commented on March 23rd 20 at 19:21
Qiwi is? If some question is not will cost in the region of 1000 rubles, I do not mind - chandler.Labadie commented on March 23rd 20 at 19:24
@chandler.Labadie, Qiwi no. Yes, and too much time to get there, its enough work.
Formulates the question briefly and post on the Toaster. - vicenta42 commented on March 23rd 20 at 19:27

Find more questions by tags C#MySQL