xxxxxxxxxx
to start postgres, go to bin, open cmd and type:
psql.exe -U postgres
for linux:
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
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
# https://www.postgresql.org/docs/8.0/sql-createuser.html
CREATE USER <username> WITH PASSWORD '<password>' VALID UNTIL '<date here>';
xxxxxxxxxx
CREATE USER jonathan;
CREATE USER davide WITH PASSWORD 'jw8s0F4';
CREATE USER miriam WITH PASSWORD 'jw8s0F4' VALID UNTIL '2005-01-01';
CREATE USER manuel WITH PASSWORD 'jw8s0F4' CREATEDB;
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
xxxxxxxxxx
#!/usr/bin/env bash
# to execute, open a terminal in directory and run chmod +x <filename>.sh
user="{user name}"
database="{database name}"
args="--host=localhost --dbname=$database --username=$user"
echo -e "Creating user $user.....\n"
sudo -u postgres createuser --createdb --pwprompt $user
echo -e "User Created!\n"
echo -e "Creating database $database.....\n"
sudo -u postgres createdb --owner=$user $database
echo -e "Database Created!\n"
echo -e "Restarting server and starting psql....\n"
sudo service postgresql restart
psql $args