每一年都奔走在自己热爱里

没有人是一座孤岛,总有谁爱着你

postgres数据绿色版如何启动

1.写个简单的批处理文件,名字任意.****

set PGHOME=D:\tool\postgresql12\pgsql
set PATH=%PGHOME%\bin;%path%
set PGHOST=localhost
set PGLIB=%PGHOME%\lib
set PGDATA=%PGHOME%\data

我这里叫inst.bat:

将这个批处理文件复制到D:\tool\postgresql12\pgsql

2:打开cmd,切换到你的pgsql目录,我的目录为D:\tool\postgresql12\pgsql

3:进入D:\tool\postgresql12\pgsql>inst

**4:初始化数据库 **

D:\tool\postgresql12\pgsql\bin> initdb --locale=C

5.启动

D:\tool\postgresql12\pgsql\bin> pg_ctl start

6.这个cmd窗口不要关,再开一个cmd窗口
创建数据库

D:\tool\postgresql12\pgsql\bin> createdb -h 127.0.0.1 mydb

创建用户

D:\tool\postgresql12\pgsql\bin> createuser -h 127.0.0.1 scott

新的角色是否是超级用户? (y/n) y
D:\tool\postgresql12\pgsql\bin>
8.打开图形操作界面管理数据库D:\pgsql\bin\pgAdmin3.exe

posted @ 2022-06-09 10:24  星星之草%  阅读(244)  评论(1编辑  收藏  举报