Thread: Moving from MySQL
Hi all, new to pgsql yadda yadda I have a default RedHat install and run into the following problem When trying to connect to postgres I get the following message.. [kevin@anthem kevin]$ postgres postgres does not know where to find the database system data. You must specify the directory that contains the databasesystem either by specifying the -D invocation option or by setting the PGDATA environment variable. ok, so I su to the user postgres and try... bash-2.05b$ postgres -D /var/lib/pgsql/data/ Lock file "/var/lib/pgsql/data//postmaster.pid" already exists. Is another postmaster (pid 16943) running in "/var/lib/pgsql/data/"? What seems to be the problem here? Kind regards Kevin -- Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html Kevin Waterson Port Macquarie, Australia
For a quick solution run "netstat -tlnp" and see if postgres is running. If it is, kill it. Otherwise just delete the loc file. I can't make any guarentees on how safe this is though ... --- Rob ************************** Rob Cherry mailto:rob@jamwarehouse.com +27 21 447 7440 Jam Warehouse RSA Smart Business Innovation http://www.jamwarehouse.com ************************** -----Original Message----- From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Kevin Waterson Sent: Monday, January 13, 2003 2:51 PM To: pgsql-novice@postgresql.org Subject: [NOVICE] Moving from MySQL Hi all, new to pgsql yadda yadda I have a default RedHat install and run into the following problem When trying to connect to postgres I get the following message.. [kevin@anthem kevin]$ postgres postgres does not know where to find the database system data. You must specify the directory that contains the database system either by specifying the -D invocation option or by setting the PGDATA environment variable. ok, so I su to the user postgres and try... bash-2.05b$ postgres -D /var/lib/pgsql/data/ Lock file "/var/lib/pgsql/data//postmaster.pid" already exists. Is another postmaster (pid 16943) running in "/var/lib/pgsql/data/"? What seems to be the problem here? Kind regards Kevin -- Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html Kevin Waterson Port Macquarie, Australia ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
This one time, at band camp, "Rob" <rob@jamwarehouse.com> wrote: > For a quick solution run "netstat -tlnp" and see if postgres is running. If > it is, kill it. Otherwise just delete the loc file. I can't make any > guarentees on how safe this is though ... Worked a treat, thanks now, if I do #createuser kevin from the command line it seems ok.. but when I try [kevin@anthem file_db]$ psql kevin psql: FATAL 1: Database "kevin" does not exist in the system catalog. How do I create the database from kevin In MySQL I would do something like mysqladmin create <dbname> -u root -p Kind regards Kevin -- Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html Kevin Waterson Port Macquarie, Australia
Kevin Waterson wrote:
> This one time, at band camp,
> "Rob" <rob@jamwarehouse.com> wrote:
>
>> For a quick solution run "netstat -tlnp" and see if postgres is
>> running. If it is, kill it. Otherwise just delete the loc file. I
>> can't make any guarentees on how safe this is though ...
>
> Worked a treat, thanks
>
> now, if I do
> #createuser kevin
> from the command line it seems ok..
> but when I try
> [kevin@anthem file_db]$ psql kevin
> psql: FATAL 1: Database "kevin" does not exist in the system catalog.
>
> How do I create the database from kevin
>
Assuming you are now the postgres user:
createdb kevin
you can invoke user kevin with any db as well
psql -U kevin -d template1
Note: If you want kevin to have all rights to the database kevin you'll have to make him the owner some how (eg create Kevin with createdb rights, create the database as Kevin, then remove the rights in psql (as postgres) alter user kevin nocreatedb).
hth,
- Stuart
DISCLAIMER:The information in this message is confidential and may be legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. Thank you.
Kevin Waterson <kevin@oceania.net> writes: > Hi all, new to pgsql yadda yadda > I have a default RedHat install and run into the following problem > When trying to connect to postgres I get the following message.. > [kevin@anthem kevin]$ postgres 'postgres' is the server backend; you should not be invoking it directly. 'psql' is the usual command-line frontend that you might actually want to use. However, now that you've killed the postmaster there is no server process for psql to talk to. You could restart the postmaster manually, but it might be easier just to reboot the machine. regards, tom lane
Kevin, You need to read a primer on PostgreSQL before you do anything else. We can't talk you through, on this list, all of the basic commands and concepts. There are two complete books online in the "User's Lounge" portion of the PostgreSQL web site; start with those. -Josh
This one time, at band camp, "Henshall, Stuart - Design & Print" <SHenshall@westcountry-design-print.co.uk> wrote: > Assuming you are now the postgres user: > createdb kevin > you can invoke user kevin with any db as well > psql -U kevin -d template1 > Note: If you want kevin to have all rights to the database kevin you'll have > to make him the owner some how (eg create Kevin with createdb rights, create > the database as Kevin, then remove the rights in psql (as postgres) alter > user kevin nocreatedb). This worked a treat... Thank you, and others who replied for your time, I am sure I will have more questions in future. Kind regards Kevin -- Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html Kevin Waterson Port Macquarie, Australia