0

I'm trying to set up an application with Django through Elastic Beanstalk and MySQL through RDS. I can successfully use the application on localhost with the MySQL RDS database. When I deploy, I have problems.

I get

"111: Connection refused"

but maybe more importantly

"mysql_config: command not found, mariadb_config: command not found, mysql_config: command not found"

Posts on here talk about using yum in a packages.config file, I tried those suggestions without success. Isn't yum for use on operating systems other than MacOS?

I followed the instructions here: https://pypi.org/project/mysqlclient/

And of course mysqlclient is in my requirements.txt

Obviously I need the files mentioned above, but how do I get them?

phershbe
  • 169
  • 4
  • 12
  • Possible duplicate of https://stackoverflow.com/q/62111066/7168030 – hashlash Mar 12 '22 at 01:06
  • Yeah I understand basically what I need, but do I install yum on my computer with MacOS and then use it to download the things I need for the server OS? – phershbe Mar 12 '22 at 01:33
  • 1
    Nope, you don't need to install yum on your computer in order to use it on your server. And I think yum is already available on Elastic Bean, so you don't need to install yum on Elastic Bean either. You just need to install the required binaries using yum on Elastic Bean. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-packages – hashlash Mar 12 '22 at 02:05

1 Answers1

1

mysqlclient is just like a python wrapper, and it needs the MySQL client binary (and other required tools) installed on the OS. The binary installation varies based on the server OS.

I believe by what you said MacOS is your computer OS, not the server OS, right? You must check your Elastic Bean configuration and install the required binaries based on your Elastic Bean OS. For knowing what the required binaries are, you can refer to the mysqlclient docs (Windows, Linux, MacOS)

Taking an example from an SO answer, one of yaml config to install the binary:

packages: 
  yum:
    python3-devel: []
    mariadb-devel: []

2023 Important update for the new Linux Platforms:

mariadb-devel is no longer the name of the package. Instead, use

packages:  
  yum:  
    python3-devel: []
    mariadb105-devel.x86_64: []
Salman Malik
  • 923
  • 6
  • 24
hashlash
  • 897
  • 8
  • 19
  • Yeah correct MacOS is my computer OS, I think the server is Amazon Linux 2. I did the top part in the documentation, I don't understand what the bottom part with the path does. I did make a packages.config file with that in it but it didn't work. Do I have to install yum and will yum work on my OS? (I understand that I need yum for the server OS.) – phershbe Mar 12 '22 at 01:29
  • @phershbe Which part did you don't understand? `mariadb-devel`? Can you include your `packages.config` to your question? And, you don't need to install `yum` on your computer OS – hashlash Mar 12 '22 at 02:00
  • I copied that exactly into packages.config which is in .ebextensions. I get back "ERROR: ServiceError - Failed to deploy application." on the command line. I'm doing this by eb deploy. Do I need to upload again from the start? (I'm going to try of course.) – phershbe Mar 12 '22 at 02:51
  • I tried again (as noted in my comment immediately above) and didn't have success. Now it seems that the 111 errors have disappeared at least. Everything still works fine on localhost. – phershbe Mar 12 '22 at 03:31
  • I got things working. I guess there was a problem somewhere else in my configuration. I went back and redid my configuration and uploads from scratch and things worked. I'm new to AWS so it's kind of like my early days of writing code getting stuck on stupid things. – phershbe Mar 12 '22 at 04:51