I want to run postgresql in manjaro by the following command.
sudo systemctl start postgresql
And i got the following result.
Job for postgresql.service failed because the control process exited with error code.See "systemctl status postgresql.service" and "journalctl -xeu postgresql.service" for details.
The log was as follow.
Jul 29 17:22:43 mahyar-pc postgres[2078]: "/var/lib/postgres/data" is missing or empty. Use a command like
Jul 29 17:22:43 mahyar-pc postgres[2078]: su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgr>
Jul 29 17:22:43 mahyar-pc postgres[2078]: with relevant options, to initialize the database cluster.
Jul 29 17:22:43 mahyar-pc systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILU>
Is there any way to solve it?
CodePudding user response:
I think you need to initialize PostgreSQL’s data directory.
From line 2 of the log, you can initialize with su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"