postgresql学习笔记

postgresql学习笔记

安装

官方下载安装,已同步onedrive

https://www.postgresql.org/

文档:https://www.postgresql.org/docs/11

系统是win10 64 
1.控制面板-用户账户-> 添加用户postgres,并赋予管理员权限 

初始化:

initdb.exe -D d:\postgresql\data -E UTF-8 --locale=chs -U postgres -W

-D :指定数据库簇的存储目录E:\pgsql\data

-E :指定DB的超级用户的用户名postgres

--locale:关于区域设置(chinese-simplified-china)

-U :默认编码格式chs

-W :为超级用户指定密码的提示

启动服务:pg_ctl start

停止服务:pg_ctl stop

图形化界面:pgAdmin 4。需要先创建连接

环境变量PATH添加:D:\Software\PostgreSQL\bin

环境变量PGDATA添加:D:\Software\PostgreSQL\data

基本操作

数据库由客户端和服务器组成。

创建数据库:createdb -h localhost -U postgres mydb   默认用户名postgres

#

猜你喜欢

转载自www.cnblogs.com/chenxygx/p/10226858.html