create user: CREATE USER davide WITH PASSWORD 'jw8s0F4';
Examples
To create a new database:
CREATE DATABASE lusiadas;
To create a database sales owned by user salesapp with a default tablespace of salesspace:
CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
To create a database music which supports the ISO-8859-1 character set:
CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
CREATE DATABASE zulip ENCODING 'utf8' OWNER zulip;
Examples
Change a user's password:
ALTER USER davide WITH PASSWORD 'hu8jmn3';
Change the expiration date of the user's password:
ALTER USER manuel VALID UNTIL 'Jan 31 2030';
Change a password expiration date,specifying that the password should expire at midday on 4th May 2005 using the time zone which is one hour ahead of UTC:
ALTER USER chris VALID UNTIL 'May 4 12:00:00 2005 +1';
Make a password valid forever:
ALTER USER fred VALID UNTIL 'infinity';
Give a user the ability to create other users and new databases:
ALTER USER miriam CREATEUSER CREATEDB; fe_sendauth: no password supplied 给dbuser设置登录密码(之前没设置密码的时候登录报这个错psql: fe_sendauth: no password supplied,设置了就ok了)root@i-1lb6pxls:/home/ubuntu/campo/shared# sudo -u postgres psql psql (9.4.4) Type "help" for help. postgres=# \password dbuser Enter new password: Enter it again: postgres=# \q change to trust in pg_hba.conf接下来需要讲数据库uppers_staging 的所有权限都赋给dbuser,否则dbuser只能登录控制台,没有操作数据库的权限
GRANT ALL PRIVILEGES ON DATABASE zulip to zulip;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。