PostgreSQL Database Cluster Initialisation Failed Solution

How to install postgreSQL on Windows Server 2008 64Bit

I tried several times to install postgreSQl on Windows Server 2008, but failed due to "PostgreSQL Database Cluster Initialization".
I tried to install it to another path instead of c:\Program files(x86), but no success. Then I follow one solution online proposed for vista, adding full control power for the use postgres on the installing folder. Again there is no success.
Then I tried to install it through the binariew installer. The one I used is v8.3.7.

PostgreSQL Database Cluster Initialisation Failed Solution

How to install postgreSQL on Windows Server 2008 64Bit

I tried several times to install postgreSQl on Windows Server 2008, but failed due to "PostgreSQL Database Cluster Initialization".
I tried to install it to another path instead of c:\Program files(x86), but no success. Then I follow one solution online proposed for vista, adding full control power for the use postgres on the installing folder. Again there is no success.
Then I tried to install it through the binariew installer. The one I used is v8.3.7.

Error : “ 'more' is not recognized as an internal or external command, operable program or batch file. "

When you type in \dt and the postgreSQl pops " 'more' is not recognized as an internal or external command, operable program or batch file. "

This is because "more" exists in C:\Windows\System32 and you did not add it to your PATH Environment Variable.
To do so, My Computer (Right Click) -> Properties -> then go to Advanced tab -> Environment Variable -> set the path by adding C:\Windows\System32. Be sure to use ; to separate from other paths may exit here.

Error : “ 'more' is not recognized as an internal or external command, operable program or batch file. "

When you type in \dt and the postgreSQl pops " 'more' is not recognized as an internal or external command, operable program or batch file. "

This is because "more" exists in C:\Windows\System32 and you did not add it to your PATH Environment Variable.
To do so, My Computer (Right Click) --> Properties --> then go to Advanced tab --> Environment Variable --> set the path by adding C:\Windows\System32. Be sure to use ; to separate from other paths may exit here.

$2222

PostgreSQL常规用法

PostgreSQL的实用程序:
(1)用户实用程序:
createdb 创建一个新的PostgreSQL的数据库(和SQL语句:CREATE DATABASE 相同)
createuser 创建一个新的PostgreSQL的用户(和SQL语句:CREATE USER 相同)
dropdb 删除数据库
dropuser 删除用户
pg_dump 将PostgreSQL数据库导出到一个脚本文件
pg_dumpall 将所有的PostgreSQL数据库导出到一个脚本文件
pg_restore 从一个由pg_dump或pg_dumpall程序导出的脚本文件中恢复PostgreSQL数据库
psql 一个基于命令行的PostgreSQL交互式客户端程序
vacuumdb 清理和分析一个PostgreSQL数据库,它是客户端程序psql环境下SQL语句VACUUM的shell脚本封装,二者功能完全相同
(2)系统实用程序
initdb 创建一个用于存储数据库的PostgreSQL数据目录,并创建预定义的模板数据库template0和template1,生成共享目录表catalog;此程序通常只在安装PostgreSQL时运行一次
initlocation 创建一个辅助的PostgreSQL数据库存储区域
ipcclean 从停止的PostgreSQL服务器中清除共享内在和孤立信号标志
pg_ctl 启动、停止、重启PostgreSQL服务(比如:pg_ctl start 启动PostgreSQL服务,它和service postgresql start相同)
pg_controldata 显示PostgreSQL服务的内部控制信息
postgres PostgreSQL单用户模式的数据库服务
postmaster PostgreSQL多用户模式的数据库服务
4.这里面最重要的是psql这个客户端程序最为重要。启用客户端程序psql的方法是:
切换到PostgreSQL预定义的数据库超级用户postgres,启用客户端程序psql,并连接到自己想要的数据库,比如说:
psql template1
出现以下界面,说明已经进入到想要的数据库,可以进行想要的操作了。
template1=#
5.在数据库中的一些命令:
template1=# \l 查看系统中现存的数据库
template1=# \q 退出客户端程序psql
template1=# \c 从一个数据库中转到另一个数据库中,如template1=# \c sales 从template1转到sales
template1=# \dt 查看表
template1=# \d 查看表结构
template1=# \di 查看索引
6.要注意随时对数据库进行清理、收回磁盘空间并更新统计信息,使用下面的命令就搞定!
vaccumdb -d sales -z
-a 对所有的数据库操作
-z 保证不断地删除失效的行,节约磁盘空间,将统计信息更新为最近的状态
7.PostgreSQL用户认证
PostgreSQL数据目录中的pg_hba.conf的作用就是用户认证,可以在/var/lib/pgsql/data中找到。
有以下几个例子可以看看:
(1)允许在本机上的任何身份连接任何数据库
TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust(无条件进行连接)
(2)允许IP地址为192.168.1.x的任何主机与数据库sales连接
TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host sales all 192.168.1.0 255.255.255.0 ident sameuser(表明任何操作系统用户都能够以同名数据库用户进行连接)
8.看了那么多,来一个完整的创建PostgreSQL数据库用户的示例吧
(1)进入PostgreSQL高级用户
(2)启用客户端程序,并进入template1数据库
psql template1
(3)创建用户
template1=# CREATE USER hellen WITH ENCRYPED PASSWORD'zhenzhen'
(4)因为设置了密码,所以要编辑pg_hba.conf,使用户和配置文件同步。
在原有记录上面添加md5
local all hellen md5
(4)使用新用户登录数据库
template1=# \q
psql -U hellen -d template1
PS:在一个数据库中如果要切换用户,要使用如下命令:
template1=# \!psql -U tk -d template1
9.设定用户特定的权限
还是要用例子来说明:
创建一个用户组:
sales=# CREATE GROUP sale;
添加几个用户进入该组
sales=# ALTER GROUP sale ADD USER sale1,sale2,sale3;
授予用户级sale针对表employee和products的SELECT权限
sales=# GRANT SELECT ON employee,products TO GROUP sale;
在sale中将用户user2删除
sales=# ALTER GROP sale DROP USER sale2;
10.备份数据库
可以使用pg_dump和pg_dumpall来完成。比如备份sales数据库:
pg_dump sales>/home/tk/pgsql/backup/1.bak

PostgreSQL常规用法

PostgreSQL的实用程序:
(1)用户实用程序:
createdb 创建一个新的PostgreSQL的数据库(和SQL语句:CREATE DATABASE 相同)
createuser 创建一个新的PostgreSQL的用户(和SQL语句:CREATE USER 相同)
dropdb 删除数据库
dropuser 删除用户
pg_dump 将PostgreSQL数据库导出到一个脚本文件
pg_dumpall 将所有的PostgreSQL数据库导出到一个脚本文件
pg_restore 从一个由pg_dump或pg_dumpall程序导出的脚本文件中恢复PostgreSQL数据库
psql 一个基于命令行的PostgreSQL交互式客户端程序
vacuumdb 清理和分析一个PostgreSQL数据库,它是客户端程序psql环境下SQL语句VACUUM的shell脚本封装,二者功能完全相同
(2)系统实用程序
initdb 创建一个用于存储数据库的PostgreSQL数据目录,并创建预定义的模板数据库template0和template1,生成共享目录表catalog;此程序通常只在安装PostgreSQL时运行一次
initlocation 创建一个辅助的PostgreSQL数据库存储区域
ipcclean 从停止的PostgreSQL服务器中清除共享内在和孤立信号标志
pg_ctl 启动、停止、重启PostgreSQL服务(比如:pg_ctl start 启动PostgreSQL服务,它和service postgresql start相同)
pg_controldata 显示PostgreSQL服务的内部控制信息
postgres PostgreSQL单用户模式的数据库服务
postmaster PostgreSQL多用户模式的数据库服务
4.这里面最重要的是psql这个客户端程序最为重要。启用客户端程序psql的方法是:
切换到PostgreSQL预定义的数据库超级用户postgres,启用客户端程序psql,并连接到自己想要的数据库,比如说:
psql template1
出现以下界面,说明已经进入到想要的数据库,可以进行想要的操作了。
template1=#
5.在数据库中的一些命令:
template1=# \l 查看系统中现存的数据库
template1=# \q 退出客户端程序psql
template1=# \c 从一个数据库中转到另一个数据库中,如template1=# \c sales 从template1转到sales
template1=# \dt 查看表
template1=# \d 查看表结构
template1=# \di 查看索引
6.要注意随时对数据库进行清理、收回磁盘空间并更新统计信息,使用下面的命令就搞定!
vaccumdb -d sales -z
-a 对所有的数据库操作
-z 保证不断地删除失效的行,节约磁盘空间,将统计信息更新为最近的状态
7.PostgreSQL用户认证
PostgreSQL数据目录中的pg_hba.conf的作用就是用户认证,可以在/var/lib/pgsql/data中找到。
有以下几个例子可以看看:
(1)允许在本机上的任何身份连接任何数据库
TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust(无条件进行连接)
(2)允许IP地址为192.168.1.x的任何主机与数据库sales连接
TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host sales all 192.168.1.0 255.255.255.0 ident sameuser(表明任何操作系统用户都能够以同名数据库用户进行连接)
8.看了那么多,来一个完整的创建PostgreSQL数据库用户的示例吧
(1)进入PostgreSQL高级用户
(2)启用客户端程序,并进入template1数据库
psql template1
(3)创建用户
template1=# CREATE USER hellen WITH ENCRYPED PASSWORD'zhenzhen'
(4)因为设置了密码,所以要编辑pg_hba.conf,使用户和配置文件同步。
在原有记录上面添加md5
local all hellen md5
(4)使用新用户登录数据库
template1=# \q
psql -U hellen -d template1
PS:在一个数据库中如果要切换用户,要使用如下命令:
template1=# \!psql -U tk -d template1
9.设定用户特定的权限
还是要用例子来说明:
创建一个用户组:
sales=# CREATE GROUP sale;
添加几个用户进入该组
sales=# ALTER GROUP sale ADD USER sale1,sale2,sale3;
授予用户级sale针对表employee和products的SELECT权限
sales=# GRANT SELECT ON employee,products TO GROUP sale;
在sale中将用户user2删除
sales=# ALTER GROP sale DROP USER sale2;
10.备份数据库
可以使用pg_dump和pg_dumpall来完成。比如备份sales数据库:
pg_dump sales>/home/tk/pgsql/backup/1.bak

Installation of Ubuntu on Vista pre-installed machine and preparation for using EasyBCD as booting manager

Installation of Ubuntu on Vista pre-installed machine and preparation for using EasyBCD as booting manager.

1. First you need prepare some free disk space for ubuntu by using Vista disk manager.

2. Insert your Ubuntu CD or DVD in the drive, and boot from it to begin setup. Choose "install Ubuntu" from the
bootable menu.

3. Follow the on screen instructions until you get to a screen asking you for your preferred method of
partition your hard drives. Make sure you choose "manual" at this point so you can configure your dual-boot
exactly as you need it.

3. Find the free space on the drive which you prepared in vista and create a new
partition there. Choose "ext3" as the filesystem type, and use it as the root "/" the mountpoint.
Here you can partition (n-2)G of your free space as the main partition to install Ubuntu. And use the rest of the partition 2G as the swap disk (choose swap as filesystem).

4.Once you've partitioned the drive the way you like it, you come to the single most-important step: telling Ubuntu
where to install GRUB, the Linux bootloader.
pay special attention here, on the final install conclusion screen there is a "advanced" button, click it to set up the installation destitionation of GRUB. Here you need to choose the partition which you used as the root mountpoint.

4.finished installation.
5.Boot into vista and install EasyBCD.
6. go to "Add/remove Entries" page. choose "Linux" tab from the bottom-half of the screen.
7.Pick the partition you installed Ubuntu to earlier from the drop-down partition list and choose "Add entry"
8. save

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...