Tutor-mysql – Connection error after setting OPENEDX_MYSQL_PASSWORD

Running tutor 13.3.1 (maple)

I’m receiving the following on tutor-dev when I set the OPENEDX_MYSQL_PASSWORD in our tutor-config plugin.

LMS Container IP Address
172.18.0.13

tutor-config/config/plugin.py

################# Configuration
config = {
    # Add here your new settings
    "defaults": {
        "VERSION": __version__,
    },
    # Add here settings that don't have a reasonable default for all users. For
    # instance: passwords, secret keys, etc.
    "unique": {
        # "SECRET_KEY": "\{\{ 24|random_string \}\}",
    },
    # Danger zone! Add here values to override settings from Tutor core or other plugins.
    "overrides": {
        "OPENEDX_MYSQL_USERNAME": "openedx",
        "OPENEDX_MYSQL_PASSWORD": "<new_password>",
    },
}

Connection Error

2022-08-10T13:01:50.191301Z 42 [Note] Access denied for user ‘openedx’@‘172.18.0.13’ (using password: YES)

After further diagnosing the connection issue, here is what I believe is the issue.

Looking at the mysql.user table it appears the host can be anything with %.

image

After performing a SHOW GRANTS FOR 'openedx'@'%'; here are the grants. Strange that you cannot connect with this '%' host.

GRANT USAGE ON . TO ‘openedx’@‘%’

GRANT ALL PRIVILEGES ON openedx.* TO ‘openedx’@‘%’

Anyway I created a new user with host as the LMS container 172.18.0.13 and I was able to connect just fine. We setup a specific host IP anyway for hawthorn production, so I’ll go ahead and do this now. Hopefully I can find the IP from the LMS container to set this automatically because Docker container get an IP set dynamically.

I ran the following command to create the user and assign privileges manually.

CREATE USER ‘openedx’@‘172.18.0.13’ IDENTIFIED BY ‘<new_password>’;

GRANT ALL PRIVILEGES ON openedx.* TO ‘openedx’@‘172.18.0.13’

And when I run I received the following privileges set.

GRANT USAGE ON . TO ‘openedx’@‘172.18.0.13’

GRANT ALL PRIVILEGES ON openedx.* TO ‘openedx’@‘172.18.0.13’

Should we post this on a discussion post with Open edX or just let this be? I’ll have to specify all Docker containers that access the database using this openedx account.

cc @regis @traek728 @becdavid