ERPNext Internal Server Error Out of Nowhere

My sites suddenly started showing internal server error today. I checked the logs and it seems access is denied for mysql users. We have changed nothing in the databases. I used Frappe Docker to install it so I do not have a mysql.ini file to edit

2023-07-14  9:49:45 317 [Warning] Access denied for user '_08999bc01d1b7871'@'172.19.0.6' (using password: YES)

The site was working perfectly fine before

Did you miss --no-mariadb-socket while bench new-site?

Add user with wildcard host, https://github.com/frappe/frappe_docker/blob/main/docs/troubleshoot.md#fixing-mariadb-issues-after-rebuilding-the-container

Okay this worked. Thankyou! I’m curious to know why this happened though. Does ‘–no-mariadb-socket’ run these commands for me in advance?

Yes. It will create {db_name}@% as user instead of {db_name}@{ip_address}.

In non-container setup the ip is localhost or 127.0.0.1 and the client connection always connects to mariadb server from same ip. Even if the first user is {db_name}@127.0.0.1 it will not fail on restarts as localhost ip remains same.

In containers the mysql client connects from multip ip addresses of different containers spawned and restarted. It is recommended to have wildcard host if you are using containers.

2 Likes

Okay I got an internal server error even when using the no mariadb socket option (on another install)

Then check what is the state of users?

select user, host from mysql.user or select user, host from mysql.global_priv

Also bench new-site --no-mariadb-socket site.name and bench new-site site.name --no-mariadb-socket may result in different output? I use the first way, it works for me most of the time. Even in container tests and helm chart I’m using bench new-site --no-mariadb-socket

I did it the second way. Let me try again

Okay it seems to work now