PostgreSQL安装
Windows 和 Linux 版安装详细步骤。
Windows
管理员cmd
cd D:\database\pgsql\bin
初始化
initdb -D D:\database\pgsql\data -U postgres -E utf-8 –locale=C -W
postgresql.conf添加
listen_addresses = ‘*’
启动数据库
pg_ctl start -D D:\database\pgsql\data
启动数据库
pg_ctl start -D D:\database\pgsql\data -l D:\database\pgsql\data\logfile
关闭数据库
pg_ctl stop -D D:\database\pgsql\data
安装windows服务
pg_ctl register -N PostgreSQL -D D:\database\pgsql\data
启动服务
net start PostgreSQL
关闭服务
net stop PostgreSQL
卸载windows服务
pg_ctl unregister -N PostgreSQL
使用超级用户 postgres 登录到主机地址为 localhost,端口号为 5432 的 PostgreSQL 数据库中并创建mars数据库。
createdb -h localhost -p 5432 -U postgres mars
创建用户lzz
create user lzz with password ‘123456’;
创建数据库指定所属者
create database dblzz owner lzz;
将dblzz所有权限赋值给lzz
grant all on database dblzz to lzz;