postgresql relate

发布时间:2020-06-30 发布网站:脚本之家
价值2580元廖雪峰前端视频终终终于免费啦!
脚本之家收集整理的这篇文章主要介绍了postgresql relate脚本之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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;

总结

以上是脚本之家为你收集整理的postgresql relate全部内容,希望文章能够帮你解决postgresql relate所遇到的程序开发问题。

如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入脚本之家官方QQ群:1065694478