Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to reset my postgresql database back to its initial condition after install. Apparently initdb is the way to do this, but although the command has a man page, it doesn't seem to be anywhere on my Ubuntu 10.10 system.

Does anyone know how this is supposed to be done on Ubuntu?

share|improve this question
    
initdb is somewhere on your system, PostgreSQL needs it to get started in the first place. –  Frank Heikens Feb 10 '11 at 15:29
add comment

2 Answers

up vote 11 down vote accepted

Personally I think you would be better off sticking with the Ubuntu specific commands, pg_lsclusters, pg_dropcluster, and pg_createcluster. These wrapper functions handle all of the filesystem layout pieces, and call initdb where necessary. It's not that you can't use the direct commands, but I've seen a lot of people get in to problems where they bypassed pieces of the regular ubuntu/debian config and then ran into problems when certain assumptions weren't met. You have a packaging solution, take advantage of it.

share|improve this answer
1  
For server software this is absolutely ass-backwards. I decide where my database data files go, not Ubuntu's overzealous re-packagers. This kind of nonsense is Exhibit A for not ever running a server on Ubuntu. –  Noah Yetter Mar 25 '13 at 20:21
1  
@NoahYetter: the script doesn't prevent you from decide that; in fact, it gives you the -d switch for such purpose. There's plenty to rant about in Ubuntu, but having sane defaults shouldn't be one. –  André Paramés May 10 '13 at 16:09
add comment

http://ubuntuforums.org/showthread.php?t=694887 suggests you want to be looking in /usr/lib/postgresql/$postgres_version/bin where you should also find createdb, createuser and similar, if you need them.

Substitute your postgres version as appropriate, obviously!

(As a more general tip: locate initdb would probably have furnished you with the answer. I don't have an Ubuntu machine with PG installed to check either the answer or this fact, though!)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.