怎么初始化postgresql
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=#
Python学习网,大量的免费PostgreSQL入门教程,欢迎在线学习!
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.