最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

PostgreSQL创建一个新的databasesystem

来源:动视网 责编:小采 时间:2020-11-09 11:43:10
文档

PostgreSQL创建一个新的databasesystem

PostgreSQL创建一个新的databasesystem:PostgreSQL 创建一个新的database system 第一步:su postgres 第二步:bash-4.2$ /usr/pgsql-9.1/bin/initdb -D /var/lib/pgsql/9.1/data/ , 回车后出现如下信息The files belonging to this database syst
推荐度:
导读PostgreSQL创建一个新的databasesystem:PostgreSQL 创建一个新的database system 第一步:su postgres 第二步:bash-4.2$ /usr/pgsql-9.1/bin/initdb -D /var/lib/pgsql/9.1/data/ , 回车后出现如下信息The files belonging to this database syst


PostgreSQL 创建一个新的database system

第一步:su postgres

第二步:bash-4.2$ /usr/pgsql-9.1/bin/initdb -D /var/lib/pgsql/9.1/data/ ,, 回车后出现如下信息

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.


The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".


fixing permissions on existing directory /var/lib/pgsql/9.1/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 24MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/9.1/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok


WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.


Success. You can now start the database server using:


/usr/pgsql-9.1/bin/postgres -D /var/lib/pgsql/9.1/data
or

/usr/pgsql-9.1/bin/pg_ctl -D /var/lib/pgsql/9.1/data -l logfile start


第三步:用上边两个命令中的一个启动服务

第四步:创建一个用户(user)

bash-4.2$ createuser qiaoning -P

Enter password for new role: //输入密码
Enter it again: //再次输入密码
Shall the new role be a superuser? (y/n) n //是否是超级用户,选否

Shall the new role be allowed to create databases? (y/n) y //该用户是否可以创建数据库,选是
Shall the new role be allowed to create more new roles? (y/n) n //该用户是否可以创建新的角色,选否

第五步:创建数据库

bash-4.2$ createdb qiaoning --owner=qiaoning //第一个qiaoning是数据库名称,第二个qiaoning是数据库的拥有者


以上步骤完成后需要修改一些配置文件(主要是访问权限的设置)

第一步:进入刚才创建的database system所在的目录,即:/var/lib/pgsql/9.1/data/

文档

PostgreSQL创建一个新的databasesystem

PostgreSQL创建一个新的databasesystem:PostgreSQL 创建一个新的database system 第一步:su postgres 第二步:bash-4.2$ /usr/pgsql-9.1/bin/initdb -D /var/lib/pgsql/9.1/data/ , 回车后出现如下信息The files belonging to this database syst
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top