QT designer can not connect to postgresql
i'm new to linux. i started the postgresql 7.4 server in the root using red hat 9 and it says that Postmaster already running. but when i used QT Designer's database connection, in which i wrote Driver: QPSQL7 database: all user: all, host: localhost a dialog box appears stating: can not connect to the database. please ensure that the database is running and that all the connection information is correct. [QPSQL: unable to connect could not connect to server. connection refused. is the server running on host localhost and accepting TCP/IP connections on port 5432?
i tried to open the pg_hba.conf and postgresql.conf to change the tcip from false to true still the problem persists. i would appreciate any help on this matter. |
The obvious question is did you reload or restart postgresql after changing the config file?
Have you set up a user and a database? Are your username and password correct? Can you log in using the terminal interface? |
The obvious question is did you reload or restart postgresql after changing the config file?
Have you set up a user and a database? Are your username and password correct? Can you log in using the terminal interface? yes i restarted postgresql and set up a user database. when i used the terminal interface i can open my database. i followed the procedure/turorial below and successfully got the same result. Login as user postgres: su - postgres Initialize PostgreSQL database server: initdb --pgdata=/var/lib/pgsql/data Starting the database server: As root. (from most to least favorite method) service postgresql start Create a database: createdb bedrock (As Linux user postgres) Connect to the database: psql bedrock Execute command as Linux user postgres You will now be at the PostgreSQL command line prompt...... and so on i just know how to use the tcip switch -i thanks again. |
i just don't know how to use the tcip switch (-i) i mean.
thanks again. |
In order to connect to the database, you will need to add a Postgresql user for the user who is connecting, and/or set the appropriate username and password in the QSql database information.
I doubt that user:all will work; try user:postgres Also, try running this: Code:
telnet 127.0.0.1 5432 |
hello
I installed postgres in my system and was working good until I think the computer crash, after that I can not access to any of the db's that I had I am trying to reload or stop the db and I get the messages psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? Any time that I try to access to the directory where are the data /usr/lib/pgsql/data say "permission denied" been postgres user, like, I do not have access to my own files [postgres@localhost root]$ postgres -D /var/lib/pgsql/data FATAL: could not open configuration file "postgresql.conf": Permission denied [postgres@localhost root]$ postmaster -D /var/lib/pgsql/data FATAL: could not read permissions of directory "/var/lib/pgsql/data": Permission denied anybody can help me??? thanks you |
alejandroye; this in an unrelated question and it should have gone in a different thread.
Having been after a crash, this sounds like it may be a filesystem problem — but it's hard to tell at this point. First look at the owner and permissions of the directories, to see if root and postgres can actually read these files: Code:
ls -ld /var/lib/pgsql/data Code:
sudo -c 'cat /etc/fstab' Code:
cat /proc/mounts |
thank you for you help
I did not mean crash, sorry, I just was trying to install a those free forum script in PHP and SQL(postgres) and when I tried to run I got the message pg_pconnect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? so, I tried to see the db and I couldn't, I tried to access as root, postgres and nothing happened also I tried to stop postgres with the line: [root@localhost root]# pg_ctl -D /var/lib/pgsql/data stop and I got the message /usr/bin/pg_ctl: line 274: kill: (3762) - No such process waiting for postmaster to shut down................................................................ failed pg_ctl: postmaster does not shut down after that I tried to start, being root and show me this [root@localhost root]# pg_ctl -D /var/lib/pgsql/data start pg_ctl: Another postmaster may be running. Trying to start postmaster anyway. "root" execution of the PostgreSQL server is not permitted. The server must be started under an unprivileged user ID to prevent possible system security compromise. See the documentation for more information on how to properly start the server. pg_ctl: cannot start postmaster Examine the log output. I loged as postgres and I tried again [postgres@localhost root]$ pg_ctl -D /var/lib/pgsql/data start FATAL: could not read permissions of directory "/var/lib/pgsql/data": Permission denied postmaster successfully started and I suppose to get access, because I already start the db like that from the begining and was working good, was after I tried to install the script PD: I am sure is not a virus or something like that because the same script is working in other servers of friend of mine rjlee: I tried the line that you told me:ls -ld /var/lib/pgsql/data and of course I can see all the files being postgres or root accessed any help I really appreciate ale |
Quote:
Quote:
Quote:
Quote:
Quote:
|
Ok, thank you very much about your help rjlee
But I fixed the problem that took me 1 week solved, I will post here to help persons like me that are not still guru in this area:D so, it will help anyway My server were working good, I could access, creater, modify and delete tables, db's and more, actually I had 4 db's that I was working Some day I dicide to install the free forum downloaded from internet (http://www.funkboard.co.uk) and suddenly I could access to my db's and I start postting help in any forum that I found aboud this so the simple solution about this were that the owner of all directories and files were change and the group it keep the same(postgres) I got: drwx------ 9 78 postgres 4096 Apr 4 22:14 base/ drwx------ 2 78 postgres 4096 Apr 12 16:36 global/ drwx------ 2 78 postgres 4096 Oct 20 12:48 pg_clog/ -rw------- 1 78 postgres 3533 Apr 5 22:11 pg_hba.conf -rw------- 1 78 postgres 1441 Oct 20 12:47 pg_ident.conf -rw------- 1 78 postgres 4 Oct 20 12:47 PG_VERSION drwx------ 2 78 postgres 4096 Mar 21 21:35 pg_xlog/ -rw------- 1 78 postgres 7815 Apr 6 00:30 postgresql.conf -rw------- 1 78 postgres 47 Apr 12 16:34 postmaster.opts -rw------- 1 78 postgre 45 Apr 12 16:34 postmaster.pid so, instead having owner postgres I was having 78, so I just change with # chown postgres -R /var/lib/pgsql and NOW is working, what happy I am now:D thanks you all and the forum by having this cool tool |
All times are GMT -5. The time now is 10:03 PM. |