ERPNext DB Access Error on fresh install

After talking to @oneitonitram, he recommend I move my issues to a public setting.

On a fresh install of ERPNext, I get that the user is unable to access the database

This results in the erpnext site responding with Internal Server Error

This happened with v3 and after reinstalling, also with v4.

Hello @premudeshi Can you share the erpnext.env

Also can you share the full logs so that it can be easy to know what the issue is

also which version are you using the new v4 with app json or the old v3 with predefined apps

I am on the v4 with app json. Here is the log. It seems there’s an issue when connecting to the db.
Here is the log, it is on pastebin as its too long to post here. How do i get the .env file?

So based on the logs You have not added The relevant apps that why its not working

No modules specified, installing erpnext by default.

Can you share your apps.json

I noticed that too, I tried the JSON from the release notes, and reconfigured it, but I get the same issue. Here is the logs, and here is the apps.json:

[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "version-16",
    "app_name": "erpnext"
  },
  {
    "url": "https://github.com/frappe/hrms",
    "branch": "version-16",
    "app_name": "hrms"
  },
  {
    "url": "https://github.com/frappe/crm",
    "branch": "develop",
    "app_name": "crm"
  }
]

Which frappe version did you choose

Version 16

After alot of back and forth with @kemboielvis22 we were finally able to get it running. We are still trying to figure out what isn’t happening during configuration.

Through the logs we were able to see that the database is not being initialized because the credentials provided in site-config.json.

To verify this, we ran:

runagent -m erpnext1
cat database.env

This gave us the json config that MariaDB is using, which looked something like:

MARIADB_AUTO_UPGRADE=1
MARIADB_DATABASE=erpnext
MARIADB_PASSWORD=db_pass
MARIADB_ROOT_PASSWORD=root_pass
MARIADB_USER=erpnext

We tested and made sure that the password specified actually worked, to do that, we logged into the mysql CLI

podman exec -it mariadb-app /bin/sh
# mariadb -u root -p

Once we verified that the root password was indeed correct, we proceed to check the config on ERPNext side

podman exec -it backend /bin/bash
bench --site all show-config -f json

Here is where we saw our mismatch:

{
 "frontend": {
  "db_host": "mariadb-app",
  "db_name": "_0e2779d88f97ac76",
  "db_password": "nHgKaCdxiGympKhH",
  "db_port": 3306,
  "db_socket": null,
  "db_type": "mariadb",
  "db_user": "_0e2779d88f97ac76",
  "redis_cache": "redis://redis-cache:6379",
  "redis_queue": "redis://redis-cache:6379",
  "redis_socketio": "redis://redis-cache:6379",
  "socketio_port": 9000
 }
}

User name and password specified here resulted in ERROR 1045 (28000): Access denied for user '_0e2779d88f97ac76'@'localhost' (using password: YES)

After learning that the credentials specified in ERPNext don’t work, we manually edited the JSON, providing the root mysql credentials

podman exec -it backend /bin/bash
vim sites/frontend/site_config.json

Once this was done, we had our second breaktrhough which was that now 2026-02-18T15:27:06-05:00 [1:erpnext7:backend] MySQLdb.OperationalError: (1049, "Unknown database '_0e2779d88f97ac76'")

At this point a simple reconfiguration from UI would be enough, but at the time, we decided to do it manually

bench --site frontend --force reinstall

With that, I could now access Frappe. To setup ERPNext, I simply reconfigured and viola, it worked!

Heres a short bandaid fix to this, if anyone comes to the same situation. I will be getting another server next week, I can test out whether I am able to reproduce this bug or not.

Thank you to @kemboielvis22 for his help!

@premudeshi thank you for the detailed analysis, and scope of works.