How to create a user in PostgreSQL

前端之家收集整理的这篇文章主要介绍了How to create a user in PostgreSQL前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
I had try to use the Windows Version of Postgresql. But I found that version of postgresql was not as friendly to users as the Windows Version of MysqL. In my point,maybe the reason why is that Postgresql use something that does work under Linux,but not under Windows. For example,when i use an account which is same as the account i login windows for starting/stoping the Postgresql service in the installition,there world be a permission error. And the installision then Failed. All would rollbacked. I had to use the default configure to install Postgresql in Windows to avoid some unnessesary problem. Anyway,I just wanna learn and use Postgresql. It's fine if it can work.

hehe,let's see how to create a user in Postgresql. It's easy.
we login the psql,and use this command:
create user andrewleung with createdb password '123456';

now,we have create a user which name 'andrewleung' with the password 123456 and the permission of create database. if we wanna cancel the permission of create database,we can use this command:
alter user andrewleung no createdb;

The complete Syntax for the CREATE USER command is

CREATE USER user-name
[[WITH] option ]...

option := SYSID user-id-number
| [NO]CREATEDB
| [NO]CREATEUSER
| IN GROUP groupname [,...]
| [[UN]ENCRYPTED ] PASSWORD 'password'
| VALID UNTIL 'expiration'
原文链接:https://www.f2er.com/postgresql/197428.html

猜你在找的Postgre SQL相关文章