postgresql installation : initdb data directory not empty? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Come Celebrate our 10 Year Anniversary!can not connect via SSH to a remote Postgresql databaseunable to connect to PostgreSQL 8.4 on Ubuntu 10.04 serverRoundcube can't connect to PostgreSQL databasePostgreSQL service initdb doesn't workPostgresql unintended upgrade to 9.2.3Cannot connect to PostgreSQL unix domain socketAfter upgrading to PostgreSQL 9.4, unable to connect from localhostUnable to connect to postgresql 9.6 server from 9.4 clientpostgresql track counts and autovacuum is not workinghow to install postgresql on centos 6.2
Protagonist's race is hidden - should I reveal it?
Simulate round-robin tournament draw
Why do people think Winterfell crypts is the safest place for women, children & old people?
false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'
Why is arima in R one time step off?
Marquee sign letters
SQL Server placement of master database files vs resource database files
How to compute a Jacobian using polar coordinates?
Are these square matrices always diagonalisable?
Writing a T-SQL stored procedure to receive 4 numbers and insert them into a table
What *exactly* is electrical current, voltage, and resistance?
Is it appropriate to mention a relatable company blog post when you're asked about the company?
In search of the origins of term censor, I hit a dead end stuck with the greek term, to censor, λογοκρίνω
How did Elite on the NES work?
Does a Draconic Bloodline sorcerer's doubled proficiency bonus for Charisma checks against dragons apply to all dragon types or only the chosen one?
Does using the Inspiration rules for character defects encourage My Guy Syndrome?
Co-worker works way more than he should
Will I lose my paid in full property
Can gravitational waves pass through a black hole?
What's the difference between using dependency injection with a container and using a service locator?
Arriving in Atlanta (after US Preclearance in Dublin). Will I go through TSA security in Atlanta to transfer to a connecting flight?
Israeli soda type drink
Was there ever a LEGO store in Miami International Airport?
France's Public Holidays' Puzzle
postgresql installation : initdb data directory not empty?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Come Celebrate our 10 Year Anniversary!can not connect via SSH to a remote Postgresql databaseunable to connect to PostgreSQL 8.4 on Ubuntu 10.04 serverRoundcube can't connect to PostgreSQL databasePostgreSQL service initdb doesn't workPostgresql unintended upgrade to 9.2.3Cannot connect to PostgreSQL unix domain socketAfter upgrading to PostgreSQL 9.4, unable to connect from localhostUnable to connect to postgresql 9.6 server from 9.4 clientpostgresql track counts and autovacuum is not workinghow to install postgresql on centos 6.2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to create the postgresql database.
When I install PostgreSQL, I gave this command:
sudo yum install postgresql postgresql-server
and later I modified the config file:
sudo vim /var/lib/pgsql/data/pg_hba.conf
and modified as
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 md5
While I am trying to startup the postgresql service:
sudo service postgresql initdb
> Data directory is not empty! [FAILED]
sudo chkconfig postgresql on
sudo service postgresql start
Starting postgresql service: [ OK ]
What is caused these errors and how do I fix them?
postgresql installation
add a comment |
I am trying to create the postgresql database.
When I install PostgreSQL, I gave this command:
sudo yum install postgresql postgresql-server
and later I modified the config file:
sudo vim /var/lib/pgsql/data/pg_hba.conf
and modified as
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 md5
While I am trying to startup the postgresql service:
sudo service postgresql initdb
> Data directory is not empty! [FAILED]
sudo chkconfig postgresql on
sudo service postgresql start
Starting postgresql service: [ OK ]
What is caused these errors and how do I fix them?
postgresql installation
add a comment |
I am trying to create the postgresql database.
When I install PostgreSQL, I gave this command:
sudo yum install postgresql postgresql-server
and later I modified the config file:
sudo vim /var/lib/pgsql/data/pg_hba.conf
and modified as
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 md5
While I am trying to startup the postgresql service:
sudo service postgresql initdb
> Data directory is not empty! [FAILED]
sudo chkconfig postgresql on
sudo service postgresql start
Starting postgresql service: [ OK ]
What is caused these errors and how do I fix them?
postgresql installation
I am trying to create the postgresql database.
When I install PostgreSQL, I gave this command:
sudo yum install postgresql postgresql-server
and later I modified the config file:
sudo vim /var/lib/pgsql/data/pg_hba.conf
and modified as
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 md5
While I am trying to startup the postgresql service:
sudo service postgresql initdb
> Data directory is not empty! [FAILED]
sudo chkconfig postgresql on
sudo service postgresql start
Starting postgresql service: [ OK ]
What is caused these errors and how do I fix them?
postgresql installation
postgresql installation
edited Jul 7 '16 at 17:51
Eric Leschinski
1,40441625
1,40441625
asked May 8 '13 at 8:14
sridharsridhar
78114
78114
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Initdb should only be run once. It will create the directory where you'll keep the config files and (usually) the actual database. You've obviously already done that already; otherwrise there wouldn't be any pg_hba.conf for you to edit.
So, just don't run postgresql initdb
again, unless you are doing a complete reinstall.
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
add a comment |
From here:
If you're completely wiping & reinstalling a Postgres DB, when running initdb
like:
service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"
you can encounter this service error:
Data directory is not empty! [FAILED]
To fix it (and this is the nuclear option -- all db data is wiped!)
On Amazon Linux (2014-x):
rm -rf /var/lib/pgsql9/data
On CentOS (6.x)
rm -rf /var/lib/pgsql/9.2/data
Now try the initdb
command again and it should work this time:
service postgresql-9.2 initdb
add a comment |
On systemd based systems like RHEL/CentOS 7 and Fedora the procedure for running initdb is somewhat different. This is no longer done by the init scripts (which no longer exist), and the new procedure is much closer to the upstream instructions.
You must first su
to the postgres
user, and then run initdb
or pg_ctl initdb
. It's not necessary to provide a data directory if you are using a Red Hat build as its default automatically chooses the default data directory /var/lib/pgsql
.
For example:
# su - postgres
$ pg_ctl initdb
$ exit
#
Of course, you only do this once, on first installation, to set up the initial data directory. You would not do it again unless you were creating a completely new installation or restoring from a disaster.
add a comment |
I had the same issue, using PostgreSQL 9.3 on CentOS 6.
I deleted the /var/lib/pgsql/9.3/data folder, then re-ran the command
sudo service postgresql-9.3 initdb
... which successfully initialised the db service again.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f505924%2fpostgresql-installation-initdb-data-directory-not-empty%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Initdb should only be run once. It will create the directory where you'll keep the config files and (usually) the actual database. You've obviously already done that already; otherwrise there wouldn't be any pg_hba.conf for you to edit.
So, just don't run postgresql initdb
again, unless you are doing a complete reinstall.
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
add a comment |
Initdb should only be run once. It will create the directory where you'll keep the config files and (usually) the actual database. You've obviously already done that already; otherwrise there wouldn't be any pg_hba.conf for you to edit.
So, just don't run postgresql initdb
again, unless you are doing a complete reinstall.
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
add a comment |
Initdb should only be run once. It will create the directory where you'll keep the config files and (usually) the actual database. You've obviously already done that already; otherwrise there wouldn't be any pg_hba.conf for you to edit.
So, just don't run postgresql initdb
again, unless you are doing a complete reinstall.
Initdb should only be run once. It will create the directory where you'll keep the config files and (usually) the actual database. You've obviously already done that already; otherwrise there wouldn't be any pg_hba.conf for you to edit.
So, just don't run postgresql initdb
again, unless you are doing a complete reinstall.
answered May 8 '13 at 8:35
Jenny DJenny D
24.3k116196
24.3k116196
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
add a comment |
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
thanks for the reply.. i run it twice... you mean the its not the problem in installation..
– sridhar
May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it.
– Jenny D
May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
Thank you very much.. then its not a problem.. if i face a problem i will let you know..
– sridhar
May 8 '13 at 8:47
add a comment |
From here:
If you're completely wiping & reinstalling a Postgres DB, when running initdb
like:
service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"
you can encounter this service error:
Data directory is not empty! [FAILED]
To fix it (and this is the nuclear option -- all db data is wiped!)
On Amazon Linux (2014-x):
rm -rf /var/lib/pgsql9/data
On CentOS (6.x)
rm -rf /var/lib/pgsql/9.2/data
Now try the initdb
command again and it should work this time:
service postgresql-9.2 initdb
add a comment |
From here:
If you're completely wiping & reinstalling a Postgres DB, when running initdb
like:
service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"
you can encounter this service error:
Data directory is not empty! [FAILED]
To fix it (and this is the nuclear option -- all db data is wiped!)
On Amazon Linux (2014-x):
rm -rf /var/lib/pgsql9/data
On CentOS (6.x)
rm -rf /var/lib/pgsql/9.2/data
Now try the initdb
command again and it should work this time:
service postgresql-9.2 initdb
add a comment |
From here:
If you're completely wiping & reinstalling a Postgres DB, when running initdb
like:
service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"
you can encounter this service error:
Data directory is not empty! [FAILED]
To fix it (and this is the nuclear option -- all db data is wiped!)
On Amazon Linux (2014-x):
rm -rf /var/lib/pgsql9/data
On CentOS (6.x)
rm -rf /var/lib/pgsql/9.2/data
Now try the initdb
command again and it should work this time:
service postgresql-9.2 initdb
From here:
If you're completely wiping & reinstalling a Postgres DB, when running initdb
like:
service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"
you can encounter this service error:
Data directory is not empty! [FAILED]
To fix it (and this is the nuclear option -- all db data is wiped!)
On Amazon Linux (2014-x):
rm -rf /var/lib/pgsql9/data
On CentOS (6.x)
rm -rf /var/lib/pgsql/9.2/data
Now try the initdb
command again and it should work this time:
service postgresql-9.2 initdb
answered Jan 18 '16 at 4:02
sv.sv.
23134
23134
add a comment |
add a comment |
On systemd based systems like RHEL/CentOS 7 and Fedora the procedure for running initdb is somewhat different. This is no longer done by the init scripts (which no longer exist), and the new procedure is much closer to the upstream instructions.
You must first su
to the postgres
user, and then run initdb
or pg_ctl initdb
. It's not necessary to provide a data directory if you are using a Red Hat build as its default automatically chooses the default data directory /var/lib/pgsql
.
For example:
# su - postgres
$ pg_ctl initdb
$ exit
#
Of course, you only do this once, on first installation, to set up the initial data directory. You would not do it again unless you were creating a completely new installation or restoring from a disaster.
add a comment |
On systemd based systems like RHEL/CentOS 7 and Fedora the procedure for running initdb is somewhat different. This is no longer done by the init scripts (which no longer exist), and the new procedure is much closer to the upstream instructions.
You must first su
to the postgres
user, and then run initdb
or pg_ctl initdb
. It's not necessary to provide a data directory if you are using a Red Hat build as its default automatically chooses the default data directory /var/lib/pgsql
.
For example:
# su - postgres
$ pg_ctl initdb
$ exit
#
Of course, you only do this once, on first installation, to set up the initial data directory. You would not do it again unless you were creating a completely new installation or restoring from a disaster.
add a comment |
On systemd based systems like RHEL/CentOS 7 and Fedora the procedure for running initdb is somewhat different. This is no longer done by the init scripts (which no longer exist), and the new procedure is much closer to the upstream instructions.
You must first su
to the postgres
user, and then run initdb
or pg_ctl initdb
. It's not necessary to provide a data directory if you are using a Red Hat build as its default automatically chooses the default data directory /var/lib/pgsql
.
For example:
# su - postgres
$ pg_ctl initdb
$ exit
#
Of course, you only do this once, on first installation, to set up the initial data directory. You would not do it again unless you were creating a completely new installation or restoring from a disaster.
On systemd based systems like RHEL/CentOS 7 and Fedora the procedure for running initdb is somewhat different. This is no longer done by the init scripts (which no longer exist), and the new procedure is much closer to the upstream instructions.
You must first su
to the postgres
user, and then run initdb
or pg_ctl initdb
. It's not necessary to provide a data directory if you are using a Red Hat build as its default automatically chooses the default data directory /var/lib/pgsql
.
For example:
# su - postgres
$ pg_ctl initdb
$ exit
#
Of course, you only do this once, on first installation, to set up the initial data directory. You would not do it again unless you were creating a completely new installation or restoring from a disaster.
answered Apr 21 '15 at 3:03
Michael Hampton♦Michael Hampton
175k27321651
175k27321651
add a comment |
add a comment |
I had the same issue, using PostgreSQL 9.3 on CentOS 6.
I deleted the /var/lib/pgsql/9.3/data folder, then re-ran the command
sudo service postgresql-9.3 initdb
... which successfully initialised the db service again.
add a comment |
I had the same issue, using PostgreSQL 9.3 on CentOS 6.
I deleted the /var/lib/pgsql/9.3/data folder, then re-ran the command
sudo service postgresql-9.3 initdb
... which successfully initialised the db service again.
add a comment |
I had the same issue, using PostgreSQL 9.3 on CentOS 6.
I deleted the /var/lib/pgsql/9.3/data folder, then re-ran the command
sudo service postgresql-9.3 initdb
... which successfully initialised the db service again.
I had the same issue, using PostgreSQL 9.3 on CentOS 6.
I deleted the /var/lib/pgsql/9.3/data folder, then re-ran the command
sudo service postgresql-9.3 initdb
... which successfully initialised the db service again.
answered Oct 12 '14 at 10:28
Fuzzy AnalysisFuzzy Analysis
1315
1315
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f505924%2fpostgresql-installation-initdb-data-directory-not-empty%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown