Single-machine server software architectures are insecure
The web server instance running the user application should never be in a position that it could acquire admin privileges. Therefore, you always need two web server instances. At the very least, the admin console should run on another port using another system user.
But even then, the user side code should not have unfettered access to the database. It must be locked down to the operations that are permissible to it. The database permission system is generally not capable of enforcing that kind of lockdown. Therefore, it is necessary to funnel its requests through a network API or else (unusual) a setuid program, which are capable of enforcing the lockdown.
A single-machine server is inherently insecure. One coding error will allow the attacker to gain all possible privileges on the application and inflict maximum damage. Server software must always be a distributed system, with at least two machines involved.