EOF

From wikieduonline
Revision as of 16:08, 2 February 2023 by ELF (talk | contribs)
Jump to navigation Jump to search


psql -h you_dp_ip -U postgres -p 5432  << EOF
CREATE DATABASE "yourdbname";
CREATE USER yourusername WITH PASSWORD yourpassword;
GRANT ALL PRIVILEGES ON DATABASE "yourdbname" to yourusername;
GRANT ALL PRIVILEGES ON SCHEMA public to yourusername;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO yourdbname;
EOF
gunzip < your_latest_backup.gz | psql -h YOUR_DB_ENDPOINT -U your_user -d your_db


sudo -u postgres -- bash -c "psql -c 'CREATE database tsdb'"
sudo -u postgres -- bash -c "psql tsdb -c 'CREATE EXTENSION IF NOT EXISTS timescaledb;'"


Related

sudo -u postgres

See also

Advertising: