Where is 'createdb'?

Started by Kevin Burtonover 13 years ago14 messagesgeneral
Jump to latest
#1Kevin Burton
rkevinburton@charter.net

This is probably a question for the authors of a book I have been reading
but it may be faster to get an answer here.

I was trying to follow along in a book 'Seven Databases in Seven Weeks' and
chapter 2 deals with PostgreSQL. One of the first things it does is issue a
command 'createdb book'. The text before this command says, "Once you have
Postgres installed, create a schema called book using the following command:
$ createdb book' But when I tried to issue this command (at a Linux command
prompt) I get 'createdb command not found'. Are the authors out of date?
What is the current command?

Kevin

#2Magnus Hagander
magnus@hagander.net
In reply to: Kevin Burton (#1)
Re: Where is 'createdb'?

On Thu, Nov 1, 2012 at 4:32 PM, Kevin Burton <rkevinburton@charter.net>wrote:

This is probably a question for the authors of a book I have been reading
but it may be faster to get an answer here.****

** **

I was trying to follow along in a book ‘Seven Databases in Seven Weeks’
and chapter 2 deals with PostgreSQL. One of the first things it does is
issue a command ‘createdb book’. The text before this command says, “Once
you have Postgres installed, create a schema called book using the
following command: $ createdb book’ But when I tried to issue this command
(at a Linux command prompt) I get ‘createdb command not found’. Are the
authors out of date? What is the current command?****

**

The authors are incorrect, in that this doesn't actually create a schema.
It creates a database. but they are not out of tdate, just incorrect - it
has never created a schema.

That said, the createdb command ships with postgresql still and should be
avaiable. Exactly where it is depends on how you installed PostgreSQL, and
which distribution of Linux you are on. You can probably find it with
"find", or by looking at the contents of whichever package you used to
install it.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#3Leif B. Kristensen
leif@solumslekt.org
In reply to: Kevin Burton (#1)
Re: Where is 'createdb'?

Torsdag 1. november 2012 16.32.42 skrev Kevin Burton :

This is probably a question for the authors of a book I have been reading
but it may be faster to get an answer here.

I was trying to follow along in a book 'Seven Databases in Seven Weeks' and
chapter 2 deals with PostgreSQL. One of the first things it does is issue a
command 'createdb book'. The text before this command says, "Once you have
Postgres installed, create a schema called book using the following
command: $ createdb book' But when I tried to issue this command (at a
Linux command prompt) I get 'createdb command not found'. Are the authors
out of date? What is the current command?

leif@balapapa ~ $ which createdb
/usr/bin/createdb

regards, Leif

#4Christopher Opena
counterveil@gmail.com
In reply to: Kevin Burton (#1)
Re: Where is 'createdb'?

What version of PostgreSQL did you install and how did you install it? I
have 9.2.1 and it installed createdb into the default /usr/bin/ path, as
did 9.1 and 9.0 before it (installed via yum in my case).

On Thu, Nov 1, 2012 at 8:32 AM, Kevin Burton <rkevinburton@charter.net>wrote:

Show quoted text

This is probably a question for the authors of a book I have been reading
but it may be faster to get an answer here.****

** **

I was trying to follow along in a book ‘Seven Databases in Seven Weeks’
and chapter 2 deals with PostgreSQL. One of the first things it does is
issue a command ‘createdb book’. The text before this command says, “Once
you have Postgres installed, create a schema called book using the
following command: $ createdb book’ But when I tried to issue this command
(at a Linux command prompt) I get ‘createdb command not found’. Are the
authors out of date? What is the current command?****

** **

Kevin****

#5Prashanth Kumar
prashanthk@hotmail.com
In reply to: Kevin Burton (#1)
Re: Where is 'createdb'?

Here is what i did on a Ubuntu linux server. I had installed postgres using apt-get install postgres.
pkumar@ulinux1:~$ sudo su - postgres[sudo] password for pkumar: postgres@ulinux3:~$ createdb authDBpostgres@ulinux3:~$ createuser -P -l authuser

You have to sudo into postgres or fix your classpath
From: rkevinburton@charter.net
To: pgsql-general@postgresql.org
Subject: [GENERAL] Where is 'createdb'?
Date: Thu, 1 Nov 2012 10:32:42 -0500

This is probably a question for the authors of a book I have been reading but it may be faster to get an answer here. I was trying to follow along in a book ‘Seven Databases in Seven Weeks’ and chapter 2 deals with PostgreSQL. One of the first things it does is issue a command ‘createdb book’. The text before this command says, “Once you have Postgres installed, create a schema called book using the following command: $ createdb book’ But when I tried to issue this command (at a Linux command prompt) I get ‘createdb command not found’. Are the authors out of date? What is the current command? Kevin

#6Kevin Burton
rkevinburton@charter.net
In reply to: Magnus Hagander (#2)
Re: Where is 'createdb'?

I type 'find createdb' and I get an error find: 'createdb' no such file or
directory.

From: Magnus Hagander [mailto:magnus@hagander.net]
Sent: Thursday, November 01, 2012 10:38 AM
To: Kevin Burton
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Where is 'createdb'?

On Thu, Nov 1, 2012 at 4:32 PM, Kevin Burton <rkevinburton@charter.net>
wrote:

This is probably a question for the authors of a book I have been reading
but it may be faster to get an answer here.

I was trying to follow along in a book 'Seven Databases in Seven Weeks' and
chapter 2 deals with PostgreSQL. One of the first things it does is issue a
command 'createdb book'. The text before this command says, "Once you have
Postgres installed, create a schema called book using the following command:
$ createdb book' But when I tried to issue this command (at a Linux command
prompt) I get 'createdb command not found'. Are the authors out of date?
What is the current command?

The authors are incorrect, in that this doesn't actually create a schema. It
creates a database. but they are not out of tdate, just incorrect - it has
never created a schema.

That said, the createdb command ships with postgresql still and should be
avaiable. Exactly where it is depends on how you installed PostgreSQL, and
which distribution of Linux you are on. You can probably find it with
"find", or by looking at the contents of whichever package you used to
install it.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#7Christopher Opena
counterveil@gmail.com
In reply to: Kevin Burton (#6)
Re: Where is 'createdb'?

You're using find in your current working directory. It seems you may need
an introduction to find for Ubuntu (based on your other thread it seems
you're using PostgreSQL 9.1 on Ubuntu):

https://help.ubuntu.com/community/find

On Thu, Nov 1, 2012 at 8:41 AM, Kevin Burton <rkevinburton@charter.net>wrote:

Show quoted text

I type ‘find createdb’ and I get an error find: ‘createdb’ no such file or
directory.****

** **

*From:* Magnus Hagander [mailto:magnus@hagander.net]
*Sent:* Thursday, November 01, 2012 10:38 AM
*To:* Kevin Burton
*Cc:* pgsql-general@postgresql.org
*Subject:* Re: [GENERAL] Where is 'createdb'?****

** **

** **

On Thu, Nov 1, 2012 at 4:32 PM, Kevin Burton <rkevinburton@charter.net>
wrote:****

This is probably a question for the authors of a book I have been reading
but it may be faster to get an answer here.****

****

I was trying to follow along in a book ‘Seven Databases in Seven Weeks’
and chapter 2 deals with PostgreSQL. One of the first things it does is
issue a command ‘createdb book’. The text before this command says, “Once
you have Postgres installed, create a schema called book using the
following command: $ createdb book’ But when I tried to issue this command
(at a Linux command prompt) I get ‘createdb command not found’. Are the
authors out of date? What is the current command?****

** **

The authors are incorrect, in that this doesn't actually create a schema.
It creates a database. but they are not out of tdate, just incorrect - it
has never created a schema.****

** **

That said, the createdb command ships with postgresql still and should be
avaiable. Exactly where it is depends on how you installed PostgreSQL, and
which distribution of Linux you are on. You can probably find it with
"find", or by looking at the contents of whichever package you used to
install it.
****

** **

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/****

#8Steve Crawford
scrawford@pinpointresearch.com
In reply to: Kevin Burton (#6)
Re: Where is 'createdb'?

On 11/01/2012 08:41 AM, Kevin Burton wrote:

I type 'find createdb' and I get an error find: 'createdb' no such
file or directory.

Which exact OS/distribution/PostgreSQL-version are you using and how was
PostgreSQL installed (OS-provided or 3rd-party)? The different packagers
deal with things in a variety of ways almost all of which are different
than how PostgreSQL will be installed if compiling from source with
default options.

Ubuntu, for example, will typically include a (non-PostgreSQL-provided)
helper package called postgresql-common which is designed to ease
running multiple versions of PostgreSQL on a single machine. It also
allows different users to connect to different clusters and has some
version-to-version update facilities (which were more important in the
pre-pg_upgrade era).

In Ubuntu, therefore, executables, data and configuration are in
version-specific subdirectories (/usr/lib/postgresql/VERSION/...,
/etc/postgresql/VERSION/..., /var/lib/postgresql/VERSION/...) and
commands like "createdb" (/usr/bin/createdb) are actually links to
/usr/share/postgresql-common/pg_wrapper which loads the appropriate
user/version-specific executable (e.g.
/usr/lib/postgresql/9.1/bin/createdb).

But RHEL/CentOS has a somewhat different layout as do other
distributions and OSs and the layouts have evolved over time so what was
correct for, say, Ubuntu 9.04 will differ from 12.10. Similarly, a
general installer like EnterpriseDB's one-click installer will use a
different layout than the distribution-specific installations.

Cheers,
Steve

#9Chris Angelico
rosuav@gmail.com
In reply to: Magnus Hagander (#2)
Re: Where is 'createdb'?

On Fri, Nov 2, 2012 at 2:37 AM, Magnus Hagander <magnus@hagander.net> wrote:

On Thu, Nov 1, 2012 at 4:32 PM, Kevin Burton <rkevinburton@charter.net>
wrote:

The text before this command says, “Once
you have Postgres installed, create a schema called book using the following
command: $ createdb book’

The authors are incorrect, in that this doesn't actually create a schema. It
creates a database. but they are not out of tdate, just incorrect - it has
never created a schema.

Sounds like the author has a MySQL background, where "schema" and
"database" are synonyms. (I have no idea why MySQL doesn't just use
"schema" and declare that there's only one "database" per install.
That would be much simpler.)

ChrisA

#10Boszormenyi Zoltan
zb@cybertec.at
In reply to: Kevin Burton (#1)
Re: Where is 'createdb'?

2012-11-01 16:32 keltezéssel, Kevin Burton írta:

This is probably a question for the authors of a book I have been reading but it may be
faster to get an answer here.

I was trying to follow along in a book 'Seven Databases in Seven Weeks' and chapter 2
deals with PostgreSQL. One of the first things it does is issue a command 'createdb
book'. The text before this command says, "Once you have Postgres installed, create a
schema called book using the following command: $ createdb book' But when I tried to
issue this command (at a Linux command prompt) I get 'createdb command not found'. Are
the authors out of date? What is the current command?

Kevin

The instructions start with "Once you have Postgres installed...".
Since the command is not available, you don't have Postgres installed.

$ which createdb
/usr/bin/createdb
$ rpm -q --whatprovides /usr/bin/createdb
postgresql-9.1.6-1.fc17.x86_64

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

#11Steve Crawford
scrawford@pinpointresearch.com
In reply to: Boszormenyi Zoltan (#10)
Re: Where is 'createdb'?

On 11/01/2012 02:10 PM, Boszormenyi Zoltan wrote:

2012-11-01 16:32 keltezéssel, Kevin Burton írta:

...I get 'createdb command not found'. Are the authors out of date?
What is the current command?

The instructions start with "Once you have Postgres installed...".
Since the command is not available, you don't have Postgres installed.

This is not correct. What it means is that the command you typed is not
in your search path or aliased in some way. The command may very well be
available elsewhere (see my earlier post in the thread for an example of
where Ubuntu places things).

$ which createdb
/usr/bin/createdb
$ rpm -q --whatprovides /usr/bin/createdb
postgresql-9.1.6-1.fc17.x86_64

Useful on rpm-based distros but I believe the OP is running a
Debian-derivative which uses apt.

Cheers,
Steve

#12Kevin Burton
rkevinburton@charter.net
In reply to: Steve Crawford (#11)
Re: Where is 'createdb'?

I watched while the OS was installed and it looked like postgres was
installed but the Ubuntu package apparently didn’t install it all or it
didn’t install it correctly.

From: Steve Crawford [mailto:scrawford@pinpointresearch.com]
Sent: Thursday, November 01, 2012 4:43 PM
To: Boszormenyi Zoltan
Cc: Kevin Burton; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Where is 'createdb'?

On 11/01/2012 02:10 PM, Boszormenyi Zoltan wrote:

2012-11-01 16:32 keltezéssel, Kevin Burton írta:

...I get ‘createdb command not found’. Are the authors out of date? What is
the current command?

The instructions start with "Once you have Postgres installed...".
Since the command is not available, you don't have Postgres installed.

This is not correct. What it means is that the command you typed is not in
your search path or aliased in some way. The command may very well be
available elsewhere (see my earlier post in the thread for an example of
where Ubuntu places things).

$ which createdb
/usr/bin/createdb
$ rpm -q --whatprovides /usr/bin/createdb
postgresql-9.1.6-1.fc17.x86_64

Useful on rpm-based distros but I believe the OP is running a
Debian-derivative which uses apt.

Cheers,
Steve

#13Steve Crawford
scrawford@pinpointresearch.com
In reply to: Kevin Burton (#12)
Re: Where is 'createdb'?

On 11/01/2012 02:49 PM, Kevin Burton wrote:

I watched while the OS was installed and it looked like postgres was
installed but the Ubuntu package apparently didn't install it all or
it didn't install it correctly.

You may have installed a portion of PostgreSQL - possibly just the
client stuff (psql, libraries and such needed to connect to a PostgreSQL
server). The deb package is usually called "postgresql-client-VERSION".
Make sure you have installed the server which is just called
"postgresql-VERSION".

Optionally you can install postgresql-contrib which contains a large
variety of available extensions (the package installs them on your
machine but you have to selectively install the specific extensions you
want into your database - see "create extension" and look for info on
"contrib").

You can also install a variety of languages for use in writing
procedural functions in PostgreSQL (plperl, plpython, pllua, pltcl, ...).

Cheers,
Steve

#14Vincent Veyron
vv.lists@wanadoo.fr
In reply to: Kevin Burton (#12)
Re: Where is 'createdb'?

Le jeudi 01 novembre 2012 à 16:49 -0500, Kevin Burton a écrit :

I watched while the OS was installed and it looked like postgres was
installed but the Ubuntu package apparently didn’t install it all or
it didn’t install it correctly.

to list the postgresql related packages installed on your system, use :

dpkg -l postgres*

(note : lower case 'l')

to list the files each installed package provides, use :

dpkg -L <package-name>

e.g. : dpkg -L postgresql-client-8.4

(note : upper case 'L')

--
Vincent Veyron
http://marica.fr/
Logiciel de gestion des assurances sinistres et des dossiers contentieux pour le service juridique