Postgresql数据库在OS X上的位置? [英] Location of postgresql database on OS X?

查看:67
本文介绍了Postgresql数据库在OS X上的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定已经回答了这个问题,但是我似乎找不到答案。

I'm sure this has been answered but I cannot seem to find an answer.

我使用Homebrew(brew install postgresql)安装了postgresql,后者已安装到/ usr / local / Cellar / postgresql。按照说明进行操作,我这样做了:

I installed postgresql using Homebrew (brew install postgresql) which installed to /usr/local/Cellar/postgresql. Afterwords per the instructions I did this:

If this is your first install, create a database with:
    initdb /usr/local/var/postgres

据我所知,initdb创建了一个新的数据库集群。因此,当我执行上述操作时,是 postgres数据库名称和数据库本身,还是仅所有postgresql数据库将需要的所有必要位?

As I understand it, initdb creates a new cluster of databases. So when I did the above is "postgres" the database name and the database itself or just all the necessary bits that all postgresql databases will need?

实际数据库在哪里?最终生活?我是Postgresql的新手,正在寻找数据库的文件或二进制文件。 那么,数据库在哪里,当我创建一个新数据库时又在哪里呢?

Where does the actual database end up living? I am new to postgresql and looking for a file or binary that is the database. So, where is the database, and when I create a new one where does it go?

推荐答案

initdb 刚刚设置目录结构以及创建新数据库所需的目录结构。要创建数据库,请使用 createdb


简介

createdb [选项...] [dbname] [description]

SYNOPSIS
createdb [ option... ] [ dbname ] [ description ]

描述

createdb创建了一个新的PostgreSQL数据库。

DESCRIPTION
createdb creates a new PostgreSQL database.

通常,执行此命令的数据库用户将成为新数据库的所有者
。但是,可以通过-O选项指定其他所有者,如果执行用户具有适当的特权,则可以指定

Normally, the database user who executes this command becomes the owner of the new database. However a different owner can be specified via the -O option, if the executing user has appropriate privileges.

createdb是SQL命令CREATE DATABASE的包装[create_database(7)]。
通过此实用程序创建数据库与通过其他方法访问服务器的
之间没有有效区别。

createdb is a wrapper around the SQL command CREATE DATABASE [create_database(7)]. There is no effective difference between creating databases via this utility and via other methods for accessing the server.

initdb 有点像在硬盘上创建新文件系统:首先创建文件系统( initdb ),然后创建文件和目录( createdb )。

initdb is sort of like creating a new file system on a hard disk: first you create the file system (initdb), then you create a files and directories (createdb).

实际的数据库文件将位于<$创建数据库后,请访问c $ c> / usr / local / var / postgres 。因此,只需创建一个数据库,然后在 / usr / local / var / postgres 下查看新内容或更改的内容。没有一个 dbname.db文件或类似的文件,每个数据库都是文件的集合,这些文件的名称仅对数据库服务器有意义。

The actual database files will be under /usr/local/var/postgres after you create the database. So, just create a database and then see what's new or changed under /usr/local/var/postgres. There isn't a single "dbname.db" file or anything like that, each database is a collection of files with names that are only meaningful to the database server.

这篇关于Postgresql数据库在OS X上的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆