Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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 ...'?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.