Solved

How to restart Postgres database?

Posted on 2010-08-18
4
1,295 Views
Last Modified: 2012-05-10
Hello,

I'm newbie to Postgres. Software version is:
- PostgreSQL 7.4.2
- Conectiva Linux 10

 I'm trying to connect pgAdmin to database server, but I can't. I got error:
"FATAL: NO PG_HBA.CONf entry for host"

I found that solution is searching for the file pg_hba.conf and then add the following line:

host all all 192.168.10.1 255.255.255.0 password

Restart the PostgreSQL database. After that, connect to PostgreSQL database server through pgAdmin.

Problem is that I don't know how to restart database.

I tried:

# /etc/rc.d/init.d/postgresql stop
or
# /etc/rc.d/init.d/postgresql restart

But got the following error:

-bash: postgresql: command not found

How do I restart database?
0
Comment
Question by:miyahira
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 6

Assisted Solution

by:Galtar99
Galtar99 earned 100 total points
ID: 33470404
Try executing as root:

/sbin/service postgresql restart
0
 
LVL 3

Expert Comment

by:jodix2002
ID: 33471478
I don't use connectiva, I use debian. But i think it is about the same.

In my box, I use postgres-8.3. So to restart my postgresql, this is the command:

/etc/init.d/postgresql-8.3 restart

In your case, you need to go to init.d and do 'ls' to see what exactly the filename of the script is...
0
 
LVL 8

Accepted Solution

by:
Julianva earned 400 total points
ID: 33472501
try this to restart

from linux command line - service servicename restart - make sure the service name is correct. you can type service then pos - press tab key the full service name should display then type restart.

you then need to vim the pg_hba.conf file - if only you are connecting to the database then use the postgres account you created during the installation you will be able to create other users in the database  or add the users to the hba file like this
type      database    user    ip-address                                                         method  
host      all                all        the machine you connecting from                      md5

the user that you add in th hba file is the user that you added to the database after connecting with the postgres account.

all means that all the databases and all the users can connect from this ip-address.

0
 

Expert Comment

by:vijaytrendz
ID: 33475130
Hey buddy, It looks like you are using pretty old PostgreSQL. PostgreSQL has developed in years and it's growing the current 8.5 i think. Okay looking at your solution. The service command "service postgresql-* restart" won't help you at all. Try this i'm sure you can restart your postgres,

Log into your server in which database runs,

login : root
password : <root's password>

su - postgres

pg_ctl -D <database_directory> restart

ex: /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data restart

Please, specify the proper postgresql database location in which it has installed.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question