LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-10-2004, 02:09 PM   #1
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
postgresql basics


Hello, I am trying to port a php application from mysql to PEAR DB. Everything is going well, but I'd like to test using the application with postgresql instead of MySQL but I'm an idiot and don't know what I'm doing.

I've installed the nessasary rpms on a Fedora system. I have the server running (the initscript has run initdb) and listening on the tcp port and unix domain socket.

My problem is that I can't seen to be able to create any users or databases, it keeps telling me that 'root' isn't a valid user. I'm not using ident (what, are you kidding me?) but instead have modified pg_hba.conf so that root from localhost is 'trusted'. But 'createdb whateva' produces:

psql: FATAL: user "root" does not exist
createdb: database creation failed

I also can't get into the command-line interface 'psql' either. With MySQL, I'm used to a 'root' user with a blank password which can be corrected afterwards. Currently, I'm too stupid to be able to figure out what account I need to attach to postgresql as in order to create users and databases.

Any help will be appreciated.
 
Old 04-10-2004, 07:18 PM   #2
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
from a root console type
# su postgres
then
$ psql -d template1
from there it's regular SQL DDL and DML stuff: create database, create table, alter table, create user, alter user, etc. Only annoying thing is psql doesn't support the "use" command; switching between databases is accomplished with \c instead.

Last edited by Crito; 04-10-2004 at 07:20 PM.
 
Old 04-10-2004, 08:10 PM   #3
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Original Poster
Rep: Reputation: 30
This was a big help, thanks. I can now get into psql. I didn't realize I had to do *anything* with the new shell user, I thought it was just a privilege separation account for postmaster.

Boy, none of my MySQL sql works with postgres; I thought that the ANSI/SQL-92 semi-compliance of both of these databases would make the transition and easy one, but I guess not. How many different ways could there be to say 'create table ...'?

Any way, thanks for your help.
 
Old 08-07-2004, 04:10 PM   #4
littlemidget
Member
 
Registered: Aug 2004
Location: Oslo, Norway.
Distribution: Debian Sarge
Posts: 171

Rep: Reputation: 30
Quote:
Originally posted by Crito
from a root console type
# su postgres
then
$ psql -d template1
What password would I use there?..

createdb: could not connect to database template1: FATAL: user "root" does not exist

# psql -d template1
psql: FATAL: user "root" does not exist

createuser: could not connect to database template1: FATAL: user "root" does not exist

How do i create new users?..

EDIT: uh, i got it.. :-)

NEW EDIT: does anyone have a url with all the commands used in PostgreSQL? :-)

Last edited by littlemidget; 08-07-2004 at 04:14 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Basics Sn7 Linux - Software 2 09-20-2004 12:23 PM
:D basics deee Linux - Newbie 6 11-10-2003 01:01 AM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM
The basics of all basics... Thaidog Linux - Newbie 1 09-20-2002 01:18 AM
C basics sabeel_ansari Programming 12 07-22-2002 10:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration