在windows下手动初始化PostgreSQL数据库教程
环境:win764sp1
PG:9.3.5
1、创建用户postgres,密码同样是postgres:
netuserpostgrespostgres/add
2、在数据库根目录下建立data目录:
C:\ProgramFiles\PostgreSQL\9.3>mddata
3、去掉administrator对data目录的权限:
C:\ProgramFiles\PostgreSQL\9.3>caclsdata/e/t/radministrator
处理的目录:C:\ProgramFiles\PostgreSQL\9.3\data
4、将data目录的权限赋给postgres用户:
C:\ProgramFiles\PostgreSQL\9.3>caclsdata/e/t/gpostgres:C
处理的目录:C:\ProgramFiles\PostgreSQL\9.3\data
5、用postgres用户打开cmd
C:\ProgramFiles\PostgreSQL\9.3>runas/user:postgrescmd.exe
输入postgres的密码:
试图将cmd.exe作为用户"SURE-PC\postgres"启动...
6、进行初始化,初始化用户为postgres,字符集为utf8,locale为C:
C:\ProgramFiles\PostgreSQL\9.3\bin>initdb.exe-D../data-Eutf8--localeC-U postgres Thefilesbelongingtothisdatabasesystemwillbeownedbyuser"postgres". Thisusermustalsoowntheserverprocess. Thedatabaseclusterwillbeinitializedwithlocale"C". Thedefaulttextsearchconfigurationwillbesetto"english". Datapagechecksumsaredisabled. fixingpermissionsonexistingdirectory../data...ok creatingsubdirectories...ok selectingdefaultmax_connections...100 selectingdefaultshared_buffers...128MB creatingconfigurationfiles...ok creatingtemplate1databasein../data/base/1...ok initializingpg_authid...ok initializingdependencies...ok creatingsystemviews...ok loadingsystemobjects'descriptions...ok creatingcollations...notsupportedonthisplatform creatingconversions...ok creatingdictionaries...ok settingprivilegesonbuilt-inobjects...ok creatinginformationschema...ok loadingPL/pgSQLserver-sidelanguage...ok vacuumingdatabasetemplate1...ok copyingtemplate1totemplate0...ok copyingtemplate1topostgres...ok syncingdatatodisk...ok WARNING:enabling"trust"authenticationforlocalconnections Youcanchangethisbyeditingpg_hba.conforusingtheoption-A,or --auth-localand--auth-host,thenexttimeyouruninitdb. Success.Youcannowstartthedatabaseserverusing: "postgres"-D"../data" or "pg_ctl"-D"../data"-llogfilestart C:\ProgramFiles\PostgreSQL\9.3\bin>
7、启动数据库,进入客户端:
C:\ProgramFiles\PostgreSQL\9.3\bin>"pg_ctl"-D"../data"start serverstarting C:\ProgramFiles\PostgreSQL\9.3\bin>LOG:databasesystemwasshutdownat2014- 09-1810:19:54HKT LOG:autovacuumlauncherstarted C:\ProgramFiles\PostgreSQL\9.3\bin>LOG:databasesystemisreadytoacceptcon nections C:\ProgramFiles\PostgreSQL\9.3\bin>psql.exe psql(9.3.5) Type"help"forhelp. postgres=#
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短