postgresql relate
create user: CREATE USER davide WITH PASSWORD 'jw8s0F4';
ExamplesTo 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;
ExamplesChange 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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |