Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1396
  • Last Modified:

How to restart Postgres database?

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
miyahira
Asked:
miyahira
2 Solutions
 
Galtar99Commented:
Try executing as root:

/sbin/service postgresql restart
0
 
jodix2002Commented:
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
 
JulianvaCommented:
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
 
vijaytrendzCommented:
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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now