Reputation: 181
I am trying to set up PostgreSQL in Linux, but the following error comes up:
[postgres@kibearch ~]$ initdb --pgdata=/var/lib/pgsql/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".
Data page checksums are disabled.
creating directory /var/lib/pgsql/data ... initdb: error: could not create directory "/var/lib/pgsql": Permission denied
If I try to use sudo initdb --pgdata=/var/lib/psql/data/
, it says that initdb
can not be used with sudo
.
Here are the steps I did:
sudo pacman -S postgresql
postgres
user using this command: su - postgres
What can I do?
Upvotes: 2
Views: 6940
Reputation: 3262
As root:
mkdir /var/lib/pgsql
chown postgres /var/lib/pgsql
As postgres:
initdb --pgdata=/var/lib/pgsql/data
Upvotes: 4