interactive with password promp and db
xxxxxxxxxx
sudo -u postgres createuser --interactive --pwprompt --createdb
xxxxxxxxxx
CREATE USER visualscrapy WITH PASSWORD '123456';
# it will create the new user in postgres
xxxxxxxxxx
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass';
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
xxxxxxxxxx
# "-W" will prompt for the password
psql -h <host-ip> -d <database-name> -U <username> -W
xxxxxxxxxx
sudo -u postgres createuser -s -i -d -r -l -w <<username>>
sudo -u postgres psql -c "ALTER ROLE <<username>> WITH PASSWORD '<<password>>';"
xxxxxxxxxx
# https://www.postgresql.org/docs/8.0/sql-createuser.html
CREATE USER <username> WITH PASSWORD '<password>' VALID UNTIL '<date here>';
sudo apt-get install postgresql
Step 6: Create a Database User Role for Handling Odoo Databases
Next, a password for the distinctive user should be defined, which is needed later in the conf file:
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo15
Make the defined user a superuser
psql
ALTER USER odoo15 WITH SUPERUSER;
And Exit from psql and also from Postgres user
\q
exit