非安装版的PostgreSQL8.3.3的首次使用经历
2008-09-09 00:01
525 查看
第一次用Postgre,已经是好多年以前了,隐约记得是在linux下边,build半天,然后手动配置库文件之类。
今天在整理资料的时候发现,Postgre出现了解压缩直接使用的版本,上边注明了for expert only. 呵呵,看来,不推荐生手使用。
为了试验一把,索性从它的官网上直接下载了一份postgresql-8.3.3-1-binaries-no-installer.zip
1. 将其解压到d:/pgsql8.3.3
2. 设置环境变量,我不想直接添加,而是写到了一个batch文件里,名为pgenv.bat
set PGHOME=d:/pgsql8.3.3
set PATH=%PGHOME%/bin;%path%
set PGHOST=localhost
set PGLIB=%PGHOME%/lib
set PGDATA=%PGHOME%/data
3.
执行 pgenv.bat
然后:
D:/pgsql8.3.3/bin>initdb
属于此数据库系统的文件宿主为用户 "******".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale Chinese_People's Republic of China.936 初始化.
initdb: locale Chinese_People's Republic of China.936 requires unsupported encod
ing GBK
Encoding GBK is not allowed as a server-side encoding.
Rerun initdb with a different locale selection.
这上边的意思好像是说不直接支持cp936, GBK,晕。于是,强制执行:
D:/pgsql8.3.3/bin>initdb --locale=zh_CN
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
属于此数据库系统的文件宿主为用户 "hex".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale Chinese_People's Republic of China.936 初始化.
initdb: locale Chinese_People's Republic of China.936 requires unsupported encod
ing GBK
Encoding GBK is not allowed as a server-side encoding.
Rerun initdb with a different locale selection.
还是不行,再换成下边的:
D:/pgsql8.3.3/bin>initdb --locale=C
属于此数据库系统的文件宿主为用户 "hex".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale C 初始化.
默认的数据库编码已经相应的设置为 SQL_ASCII.
The default text search configuration will be set to "english".
创建目录 d:/pgsql8.3.3/data ... 成功
creating subdirectories ... 成功
选择默认最大联接数 (max_connections) ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
创建配置文件 ... 成功
在 d:/pgsql8.3.3/data/base/1 中创建 template1 数据库 ... 成功
initializing pg_authid ... 成功
initializing dependencies ... 成功
创建系统视图 ... 成功
loading system objects' descriptions ... 成功
创建字符集转换 ... 成功
creating dictionaries ... 成功
对内建对象设置权限 ... 成功
创建信息模式 ... 成功
清理数据库 template1 ... 成功
拷贝 template1 到 template0 ... 成功
copying template1 to postgres ... 成功
警告: 为本地连接启动了 "trust" 认证.
你可以通过编辑 pg_hba.conf 更改或你下
次运行 initdb 时使用 -A 选项.
Success. You can now start the database server using:
"postgres" -D "d:/pgsql8.3.3/data"
or
"pg_ctl" -D "d:/pgsql8.3.3/data" -l logfile start
数据库终于初始化完毕。
4. 启动数据库
D:/pgsql8.3.3/bin>pg_ctl start
server starting
D:/pgsql8.3.3/bin>日志: 数据库上次关闭时间为 2008-09-08 23:52:28 HKT
日志: database system is ready to accept connections
日志: autovacuum launcher started
错误: 语法错误 在 "syncdb" 或附近的 第 1 个字符处
语句: syncdb
syncdb
;
错误: 语法错误 在 "*" 或附近的 第 1 个字符处
语句: *
create table t(id int primary key, col2 varchar(32))
/
select * from t
go
;
注意: CREATE TABLE / PRIMARY KEY 将要为表 "t" 创建隐含索引 "t_pkey"
5. 用psql命令试建表:
D:/pgsql8.3.3/bin>createuser spring
Shall the new role be a superuser? (y/n) y
D:/pgsql8.3.3/bin>psql -U spring iihero
欢迎来到 psql 8.3.3,这是 PostgreSQL 互动式文字终端机。
键入: /copyright 显示发行条款
/h 显示 SQL 命令的说明
/? 显示 pgsql 命令的说明
/g 或者以分号(;)结尾以执行查询
/q 退出
iihero=# /d t
没有找到任何名称为 "t" 的关联。
iihero=# create table t(id int primary key, col2 varchar(32));
注意: CREATE TABLE / PRIMARY KEY 将要为表 "t" 创建隐含索引 "t_pkey"
CREATE TABLE
iihero=# insert into t values(1, 'iihero');
INSERT 0 1
iihero=# select * from t;
id | col2
----+--------
1 | iihero
(1 笔资料列)
iihero=# quit
iihero-# /q
终于简单的配置完了,以后可以直接拿这个环境做些简单的实验了。
要想写一些code,估计还有些问题,文档里说,要求有VS2008 C Runtime库,晕,还得装这个东东。
再看看有没有低版本的非安装版的pgsql可用。
今天在整理资料的时候发现,Postgre出现了解压缩直接使用的版本,上边注明了for expert only. 呵呵,看来,不推荐生手使用。
为了试验一把,索性从它的官网上直接下载了一份postgresql-8.3.3-1-binaries-no-installer.zip
1. 将其解压到d:/pgsql8.3.3
2. 设置环境变量,我不想直接添加,而是写到了一个batch文件里,名为pgenv.bat
set PGHOME=d:/pgsql8.3.3
set PATH=%PGHOME%/bin;%path%
set PGHOST=localhost
set PGLIB=%PGHOME%/lib
set PGDATA=%PGHOME%/data
3.
执行 pgenv.bat
然后:
D:/pgsql8.3.3/bin>initdb
属于此数据库系统的文件宿主为用户 "******".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale Chinese_People's Republic of China.936 初始化.
initdb: locale Chinese_People's Republic of China.936 requires unsupported encod
ing GBK
Encoding GBK is not allowed as a server-side encoding.
Rerun initdb with a different locale selection.
这上边的意思好像是说不直接支持cp936, GBK,晕。于是,强制执行:
D:/pgsql8.3.3/bin>initdb --locale=zh_CN
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
属于此数据库系统的文件宿主为用户 "hex".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale Chinese_People's Republic of China.936 初始化.
initdb: locale Chinese_People's Republic of China.936 requires unsupported encod
ing GBK
Encoding GBK is not allowed as a server-side encoding.
Rerun initdb with a different locale selection.
还是不行,再换成下边的:
D:/pgsql8.3.3/bin>initdb --locale=C
属于此数据库系统的文件宿主为用户 "hex".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale C 初始化.
默认的数据库编码已经相应的设置为 SQL_ASCII.
The default text search configuration will be set to "english".
创建目录 d:/pgsql8.3.3/data ... 成功
creating subdirectories ... 成功
选择默认最大联接数 (max_connections) ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
创建配置文件 ... 成功
在 d:/pgsql8.3.3/data/base/1 中创建 template1 数据库 ... 成功
initializing pg_authid ... 成功
initializing dependencies ... 成功
创建系统视图 ... 成功
loading system objects' descriptions ... 成功
创建字符集转换 ... 成功
creating dictionaries ... 成功
对内建对象设置权限 ... 成功
创建信息模式 ... 成功
清理数据库 template1 ... 成功
拷贝 template1 到 template0 ... 成功
copying template1 to postgres ... 成功
警告: 为本地连接启动了 "trust" 认证.
你可以通过编辑 pg_hba.conf 更改或你下
次运行 initdb 时使用 -A 选项.
Success. You can now start the database server using:
"postgres" -D "d:/pgsql8.3.3/data"
or
"pg_ctl" -D "d:/pgsql8.3.3/data" -l logfile start
数据库终于初始化完毕。
4. 启动数据库
D:/pgsql8.3.3/bin>pg_ctl start
server starting
D:/pgsql8.3.3/bin>日志: 数据库上次关闭时间为 2008-09-08 23:52:28 HKT
日志: database system is ready to accept connections
日志: autovacuum launcher started
错误: 语法错误 在 "syncdb" 或附近的 第 1 个字符处
语句: syncdb
syncdb
;
错误: 语法错误 在 "*" 或附近的 第 1 个字符处
语句: *
create table t(id int primary key, col2 varchar(32))
/
select * from t
go
;
注意: CREATE TABLE / PRIMARY KEY 将要为表 "t" 创建隐含索引 "t_pkey"
5. 用psql命令试建表:
D:/pgsql8.3.3/bin>createuser spring
Shall the new role be a superuser? (y/n) y
D:/pgsql8.3.3/bin>psql -U spring iihero
欢迎来到 psql 8.3.3,这是 PostgreSQL 互动式文字终端机。
键入: /copyright 显示发行条款
/h 显示 SQL 命令的说明
/? 显示 pgsql 命令的说明
/g 或者以分号(;)结尾以执行查询
/q 退出
iihero=# /d t
没有找到任何名称为 "t" 的关联。
iihero=# create table t(id int primary key, col2 varchar(32));
注意: CREATE TABLE / PRIMARY KEY 将要为表 "t" 创建隐含索引 "t_pkey"
CREATE TABLE
iihero=# insert into t values(1, 'iihero');
INSERT 0 1
iihero=# select * from t;
id | col2
----+--------
1 | iihero
(1 笔资料列)
iihero=# quit
iihero-# /q
终于简单的配置完了,以后可以直接拿这个环境做些简单的实验了。
要想写一些code,估计还有些问题,文档里说,要求有VS2008 C Runtime库,晕,还得装这个东东。
再看看有没有低版本的非安装版的pgsql可用。
相关文章推荐
- 非安装版的PostgreSQL8.3.3的首次使用经历
- [记录]在Linux中Oracle安装成功后,首次启动使用时,会出现的一些问题总结和解决办法
- postgresql加密函数的安装和使用
- CentOS7下使用yum安装PostgreSQL9.6
- CentOS7下使用yum安装PostgreSQL9.6
- 数据库服务器 之 PostgreSQL安装和简单使用
- iOS 10 的坑:新机首次安装 app,请求网络权限“是否允许使用数据”(转)
- 使用yum 安装自定义安装postgresql和postgis扩展已及phpPgAdmin
- 首次使用树莓派2(安装系统+SSH+VNC+无线网络配置)
- PostgreSQL安装和简单使用
- Windows中使用二进制压缩包安装Postgresql9.6 3ff8
- postgresql监控工具pgstatspack的安装及使用
- pycharm 安装和首次使用
- postgresql的源码安装及配置使用
- PostgreSQL安装及简单使用
- postgresql pgagent 的安装及使用(linux 5.8)
- PostgreSQL及PostGIS安装和使用
- postgreSQL安装使用
- 《Visual C++ 2010入门教程》系列二:安装、配置和首次使用VS2010(转)
- ubuntu 桌面版 postgresql数据库的界面管理工具pgadmin3 安装使用