声明:本PostgreSQl实用指南系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载
首先,以下是常用命令:
③ initdb 初始化 数据库。
④ pg_ctl start 启动数据库
⑤ pg_ctl stop 停止数据库
⑥ post_svc -install 建立windows nt 服务(需要设置系统环境变量)
⑦ post_svc -remove 删除 windows nt 服务
⑧ 使用"createdb 库名" 新建数据库
⑨ 使用"createuser 用户名"创建数据库帐号
⑩ 使用"psql -h localhost -d 库名- U 用户名"进入数据库
接着来讲解:
一、下载postgresql for windows
http://www.enterprisedb.com/products/pgbindownload.do
免安装的,直接解压到硬盘的一个目录下。笔者在d:\pgsql
二、设置环境变量,可以把以下内容写成一个BAT
set PGHOME=d:\pgsql
set PATH=%PGHOME%\bin;%path%
set PGHOST=localhost
set PGLIB=%PGHOME%\lib
set PGDATA=%PGHOME%\data
笔者把它们写成了inst.bat
D:\pgsql>inst
D:\pgsql>set PGHOME=d:\pgsql
D:\pgsql>set PATH=d:\pgsql\bin;d:\pgsql\bin;d:\pgsql\bin;C:\Windows\system32;C:\
Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\
Program Files\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files\Micros
oft SQL Server\90\Tools\binn\;d:\MATLAB7\bin\win32;
D:\pgsql>set PGHOST=localhost
D:\pgsql>set PGLIB=d:\pgsql\lib
D:\pgsql>set PGDATA=d:\pgsql\data
三、初始化数据库
D:\pgsql>initdb --locale=C
The files belonging to this database system will be owned by user "Administrator
".
This user must also own the server process.
The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".
fixing permissions on existing directory d:/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in d:/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
Success. You can now start the database server using:
"postgres" -D "d:/pgsql/data"
or
"pg_ctl" -D "d:/pgsql/data" -l logfile start
四、启动
D:\pgsql>pg_ctl start
五、重新开一个MSDOS窗口
创建数据库,以mydb为例
D:\pgsql>createdb -h 127.0.0.1 mydb
创建用户
D:\pgsql>createuser -h 127.0.0.1 deepfuture
Shall the new role be a superuser? (y/n) y
D:\pgsql>
D:\pgsql>
六、启动图形界面开始管理
启动pgAdmin3.exe程序进行配置(在BIN目录下)
成功
转自:http://deepfuture.iteye.com/blog/587477
分享到:
相关推荐
postgresql在windows(包括win7)下的安装配置
本文是postgreSQL 13.5 windows安装与 Linux 安装 及 常见命令, 由作者自身一步步实践写出来了,主要也是为了记录下操作步骤备忘. 全文通俗易懂,图文并茂一步步安装 和 并使用psql 常规命令; 本文是postgreSQL 13.5 ...
PostgreSQL 在WINDOWS下的安装截图和说明 PPT格式
如何在win7虚拟机上安装postgresql?包中包含:postgresql.exepgadmin4.exerootsupd.exevcredist_x64.exe安装步骤.txt需要注意:win7系统必须是win7sp1,否则pgsql和pgadmin4不能用。win7系统下载方法有二:1,复制...
postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-windows-x64 windows安装器 postgresql-13.3-2-...
搜集了windows平台的postgreSQL的ODBC程序,官网上没有找到。注意64位系统安装32位ODBC程序后,请到C:\Windows\SysWOW64下面打开ODBC配置程序
Windows下安装PostgreSQL8.2图文并茂
PostgreSQL是一个功能强大的开源对象关系数据库管理系统。 安装数据库必备安装包。用于安全地存储数据;...PostgreSQL是跨平台的,可以在许多操作系统上运行,如Linux,FreeBSD,OS X,Solaris和Microsoft Windows等。
windows下编译安装postgresql.docx windows下编译安装postgresql.docx windows下编译安装postgresql.docx
WIN7上安装Ofbiz 数据库 postgresql 希望对大家有所帮助
原因有两个方面,一个是本身像这种数据库服务器一般都是linux系统的,另外一个比较致命,zhparser本身并没提供windows环境下的编译工程,连依赖库scws的readme里也建议在linux环境下使用,或者用cygwin或mingw一类...
windows 64位下 PostgreSQL安装包!!!!!!!!!!
PostgreSQL 10.3 WINDOWS64位 PostgreSQL 10.3 WINDOWS64位
POSTGRES 领先的许多概念只是在非常迟的时候才出现在商业数据库中。 PostgreSQL 是最初伯克利的代码的一个开放源码的继承人。 它支持大部分 SQL 标准并且提供了许多其他现代特性: 复杂查询 外键 触发器 视图 ...
Linux postgresql 安装配置
开始一段是自己在windows上使用免安装的postgresql的快速入门,而后面则是收集的psql的一些简要说明
Postgresql 10.20.2 Windows 64位安装包Postgresql 10.20.2 Windows 64位安装包Postgresql 10.20.2 Windows 64位安装包Postgresql 10.20.2 Windows 64位安装包Postgresql 10.20.2 Windows 64位安装包Postgresql ...
postgresql 优化配置,各种内存、连接数、缓存、并发、日志等策略配置。
本压缩文件详细总结了如何在Windows中安装与使用PostgreSQL,视频教程:https://www.bilibili.com/video/BV1xo4y1M7kY/?spm_id_from=333.999.0.0
postgresql数据库手动安装以及主从配置