English 中文(简体)
试图在我的环境里安置邮政,但似乎无法获准提防
原标题:Trying to get Postgres setup in my environment but can t seem to get permissions to intidb

在最近设立邮政局的铁路公司之后,电离层电离层电离层电离层电离层,但无法运行<条码>的电离层/电离层/海流/带<>。 每当我管理这个错误时,我就会发现这一错误:

The files belonging to this database system will be owned by user "Construct".
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".

creating directory /usr/local/var/postgres ... initdb: could not create directory "/usr/local/var": Permission denied
最佳回答

这应当做到:

# sudo mkdir /usr/local/var/postgres
# sudo chmod 775 /usr/local/var/postgres
# sudo chown $(whoami) /usr/local/var/postgres/
# initdb /usr/local/var/postgres

利用你的用户名称代替建筑。 因此,如果你的计算机用户名是残疾人,则该代码将:

# sudo chown $(whoami) /usr/local/var/postgres
问题回答

如果你跑到海滨,就象这样使用:

sudo mkdir /var/lib/postgres
sudo chmod 775 /var/lib/postgres
sudo chown postgres /var/lib/postgres

sudo -i -u postgres

[postgres]$ initdb --locale $LANG -E UTF8 -D  /var/lib/postgres/data 
[postgres]$ exit

sudo systemctl start postgresql.service

sudo -i -u postgres

实际需要<代码>SU至postgres 用户

  • sudo su - postgres

然后,你可以指挥。

  • initdb -E UTF8 (I prefer setting this now because UTF8 is quite flexible and this will create all clusters as UTF8 [unless you explicitly specify otherwise])

那么,你们需要创造你们的用户(如果它已经创造了一定数量的话)。

  • $ createuser -s -U postgres
  • $ Enter name of role to add: {{ my login name }} (this appears to be Construct)

then you can exit out of postgres user and you can create your own database

  • $ createdb

哪一个用户是无所作为的。 如果你不生根,你可能没有许可在地方/地方建立名录。 我建议建立/使用/地方/城市/城市/地方/地方/地方/地方/地方/地方/地方。

# mkdir -m 0700 -p /usr/local/var/postgres
# chown construct /usr/local/var/postgres

然后,您的 in(作为建筑)应获得许可。

此外,请注意,统一用户名称通常是所有用户(但也对案件敏感);是sure。 您的建筑用户实际上是资本化的? 如果有的话,请 放心>。 你们想要获得资本——许多事情将会消失。

(FYI: For Unix questions such as this, You may found Unix.SE or Ask 乌本图提供更快的答复)

现在至少应在CentOS/RHEL中这样做:

# install the binaries
sudo yum install -y postgresql-server
# create the database
sudo su postgres -c  postgresql-setup initdb 
# enable the service to start on VM start
sudo systemctl enable postgresql.service
# start the service
sudo systemctl start postgresql.service

Then you can access it with

sudo -u postgresql psql




相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签