初始化postgresql的方法
小编给大家分享一下初始化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-UpostgresThefilesbelongingtothisdatabasesystemwillbeownedbyuser"postgres".Thisusermustalsoowntheserverprocess.Thedatabaseclusterwillbeinitializedwithlocale"C".Thedefaulttextsearchconfigurationwillbesetto"english".Datapagechecksumsaredisabled.fixingpermissionsonexistingdirectory../data...okcreatingsubdirectories...okselectingdefaultmax_connections...100selectingdefaultshared_buffers...128MBcreatingconfigurationfiles...okcreatingtemplate1databasein../data/base/1...okinitializingpg_authid...okinitializingdependencies...okcreatingsystemviews...okloadingsystemobjects'descriptions...okcreatingcollations...notsupportedonthisplatformcreatingconversions...okcreatingdictionaries...oksettingprivilegesonbuilt-inobjects...okcreatinginformationschema...okloadingPL/pgSQLserver-sidelanguage...okvacuumingdatabasetemplate1...okcopyingtemplate1totemplate0...okcopyingtemplate1topostgres...oksyncingdatatodisk...okWARNING:enabling"trust"authenticationforlocalconnectionsYoucanchangethisbyeditingpg_hba.conforusingtheoption-A,or--auth-localand--auth-host,thenexttimeyouruninitdb.Success.Youcannowstartthedatabaseserverusing:"postgres"-D"../data"or"pg_ctl"-D"../data"-llogfilestartC:\ProgramFiles\PostgreSQL\9.3\bin>
7、启动数据库,进入客户端:
C:\ProgramFiles\PostgreSQL\9.3\bin>"pg_ctl"-D"../data"startserverstartingC:\ProgramFiles\PostgreSQL\9.3\bin>LOG:databasesystemwasshutdownat2014-09-1810:19:54HKTLOG:autovacuumlauncherstartedC:\ProgramFiles\PostgreSQL\9.3\bin>LOG:databasesystemisreadytoacceptconnectionsC:\ProgramFiles\PostgreSQL\9.3\bin>psql.exepsql(9.3.5)Type"help"forhelp.postgres=#
以上是初始化postgresql的方法的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。