In MySQL, these are the chants:

sudo mysql --defaults-file=/etc/mysql/debian.cnf
create database mydb;
grant all privileges on mydb.* to myuser identified by 'p@s$W0rd';

On PostgreSQL, the chants are:

sudo -u postgres createuser -DAP myuser
sudo -u postgres createdb -O myuser mydb

Very simple actually and Debian by default listen at localhost. Users can connect to its database via port 5432.

Of course, these chants are useful for developing apps. In Production, you should supply a user that can only Read/Write/Update a database. In fact, several frameworks like Laravel could setup another user just to Read the database.