Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Connect to MySQL DB hosted in an AWS EC2 server

I have developed a website with Flask, a python framework, deployed with nginx, which works fine. The website interacts with a MySQL database through pymysql and SQLAlchemy using the following URI:

"SQLALCHEMY_DATABASE_URI": "mysql+pymysql://user:password@localhost/database"

Both the website and the database are hosted in an AWS EC2 server. I am trying to access that database from my personal computer, establishing a connection with DBeaver. The tutorial I am following says to set the bind-address found in the mysqld.cnf file to 0.0.0.0:

bind-address = 0.0.0.0

However, doing so breaks the connection from the website with the database. This is the error found in the log:

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query') [SQL: ...]

Thus, I can't set the bind-address. The website works again when I comment it out. How can I keep the website working while allowing the remote access to the database?

Although I'm not sure how this helps, I have enabled the connection to the database in the AWS security group rules:

enter image description here

Any help or references regarding my problem are much appreciated. Stay safe!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The mysql configuration can be left as it is. The access protocols are already defined in AWS. What I was missing was configuring a remote user for the database, with '%' as host (which means any host is OK). Then I just entered the DB connection credentials in DBeaver, and it worked!

I am not sure how secure the connection is. Leaving the user open to any connection is probably risky. However, I am not well-read in the matter and can't assess its security status. An SSL connection may be more secure, but I don't know how to configure it.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda