Solved

How to restart Postgres database?

Posted on 2010-08-18
4
1,250 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
4 Comments
 
LVL 6

Assisted Solution

by:Galtar99
Galtar99 earned 100 total points
Comment Utility
Try executing as root:

/sbin/service postgresql restart
0
 
LVL 3

Expert Comment

by:jodix2002
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now