POSTGRESQL: Cannot log in postgresql in debian 9 - postgresql

I am trying to log in my postgresql.After researching I have solved a slew of many issues from a weird python dependency issue to creating sudoers with names and passwords as db to removing and reinstalling postgresql, still i cannot log in as the default user "postgres".
A simple error but i cannot find a straight forward answer.
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
NOTE:
My first installation,postgresql 11, I changed pg_hba.conf from peer to md5 but refused to login.
I removed postgresql 11 using many commands to purge it out of my system but am shocked anytime i do a locate postgress or locate psql i find a list of postgresql files. The most weird is running *apt-get remove --auto-remove postgresql* and sudo apt --purge remove postgresql -y then running service postgresql start only for it to start!Cannot wrap my head around this after trying several times, i thought it would be removed completely?!.
Though I can locate pg_hba.conf, the actual file is totally nonexitent when I ls the containing directory!!! Are there many /etc/ folders, seems am looking at the wrong /etc/ ?

I also faced this problem - You try this method, it's work for me.
If You using Linux then do according your server path .
Window Path ->
Go To -> C:\Program Files\PostgreSQL\11\data then Open pg_hba.conf
Find and replace md5 or sha256 to trust
local replication all trust (Change md5 or sha256 to trust)
host replication all trust (Change md5 or sha256 to trust)
Maybe this method helpful for you.

Related

pg_hba.conf for Postgresql from Windows Anaconda

I've just installed Postgressql (9.5.4 vc14_0) and Psycopg2 (2.7.5 py36h74b6da3_0) and I'm trying to use them within my Anaconda environment on Windows 10.
Whenever I run psycopg2.connect("host=localhost user=postgres") in a python interpreter or just psql on the command line I get this error:
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
I've looked at other Stackoverflow questions regarding this, some answers say to look into a pg_hba.conf file although I haven't be able to find any. Where can I find a pg_hba.conf file for my Postgresql in my Anaconda Environment for Windows? If I have to make one, what should go in it? I haven't seen another SO question that uses the same Postgresql-Anaconda-Windows setup that I'm using.
Also I've looked into services.msc but haven't seen a service regarding postgresql.
I just ran into this error as well. Similar to what you did, I followed the installation page, ran conda install -c anaconda postgresql and received the same error in your post.
I have used postgresql through direct installation before, in osx and as far as I can recall, you could just psql into the database once the installation is complete.
Maybe this isn't the case for anaconda installations. I overcame this by initializing a new database system in a new, empty folder. In my case, I created a new folder in "\AppData\Local\conda\"
-- Initialize the database system
pg_ctl init -D <path_to_your_database_system>
-- Start the database
C:/Users/kerwei/AppData/Local/Continuum/anaconda3/envs/py36/Library/bin/pg_ctl -D <path_to_your_database_system> -l logfile start
NOTE: After playing around with for awhile, I realized that once you exit the conda environment, the database instance gets terminated too - without properly shutting down. As I don't use it for production stuffs, it doesn't really bother me. However, further steps can be taken to include the database booting and shutting down during conda activate or conda deactivate to make it less cumbersome.

Cannot find PostgreSQL files, clusters, or service; what to do?

I am currently trying to install and setup PostreSQL on my computer (Debian 9) so I can use it as a local testing environment for Heroku. I have been having some problems. First, whenever I try to run psql (and similar commands), I get this error:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I have looked around on here for some fixes to this, such as this one, however I cannot find the postmaster.pid anywhere inside /usr. When looking for /var/run/postgresql, my search also turned up nothing.
Another promising answer was this one, however, I run pg_lsclusters, none appear. From a bit of searching, it says that this is probably due to initdb never being ran. I looked around for several ways to do this manually; none of them have worked or appear to exist on my system.
I have tried many of the "simple" things, such as sudo, sudo su postgres, removing and reinstalling the package and screaming at the computer.
What exactly is going on here? How do I fix it?
My OS (as mentioned before) is Debian 9, and the psql --version (which does work) is psql (PostgreSQL) 10.4 (Debian 10.4-2.pgdg90+1).

pgpoolAdmin - superuser: unknow (connetion error)

After login i got following message.
create -> /var/www/.pcppass
#insert:hostname:port:username:password
*:*:admin:postgres
*:*:postgres:postgres
*:*:administrator:postges
host$ sudo chown www-data .pcppass
... and it don't works :-/
After long time searching it seems the issue is related to pg_hba.conf and pool_hba.conf incompatibility when using wrong combinations of trusted and md5 host entries. See here and the FAQ. Those links shows how to correctly pair both conf files with this matrix :
You have to set default entries according to this matrix in order to get the so called "superuser" in pgpoolAdmin to be enabled and also to be able to allow connection throught pgpool.
I also found this answer here that helped me finally achieving to enable correct connection to backend servers: I had to mark the pgpool server as a trusted server on local network on pg_hba.conf on my postgresql servers.

how to install Odoo 9 on ubuntu?

I have pre installed postgres , postgres-9.3 and pgadmin on port 5432 and 5433 .
uninstall them then trying to install odoo 9 using http://openies.com/blog/install-openerp-odoo-9-on-ubuntu-server-14-04-lts/
this tutorial .
but when i ttrying to execute command
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
then it gives following error :
createuser: could not connect to database postgres: could not connect
to server: No such file or directory Is the server running locally
and accepting connections on Unix domain socket
"/var/run/postgresql/.s.PGSQL.5432"?
sudo netstat -nltp | grep 5432 is not showing any result .
pg_hba.conf
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
1. Introduction
In this tutorial I will learn you how to install Odoo 9 on Ubuntu 14.04. The script that you will use is based on the code from André Schenkels but has been updated and improved.
2. Downloading the script
The first step is to download my script from GitHub and to add the code in a new .sh file on your Ubuntu machine, wherever you’d like this.
For example right under /home. Open up an Ubuntu terminal and cd to the directory where you’d like to keep the script and then create the file:
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/9.0/odoo_install.sh
If you’re curious about how the whole code looks and works you can find it on my Github account.
Now open up the file and edit the parameters to your liking:
sudo nano odoo_install.sh
There are some things you can configure/change to your likings at the top of the script. You can choose if you wish to install Wkhtmltopdf or not, which version you’d like, where the location is and most importantly what the master admin password is. Tip: always modify this for every Odoo you install!
3. Making the Odoo installation file executable
The next step is to make this file executable. After you’ve made it executable you can execute it and everything will be installed automatically.
do this with the following command:
sudo chmod +x odoo_install.sh
4.Running the script
Now that the code is in your file and the file is executable you simply have to execute it with the following command:
./odoo_install.sh
You will see that the script automatically starts updates, downloads required packages, creates the user, downloads the code from Github, …
Give the script a few minutes to configure and install everything and eventually you will see something like this:
You now have a fully functional Odoo V9 on your system! Congratulations.
Odoo V9
5. Extra information
In the script you saw there was an option to change the Odoo port (OE_PORT). When you’d change this port number to 8070 in the install script it would be applied to /etc/your-config-file.conf and this would give you the ability to change the default port.
To apply these changes you should do the following:
The -c will change the configuration and memorize what you’ve changed under /etc/your-config-file.conf. Because my port was set to 8070 this is telling the Odoo that it should run on port 8070. When you would now open up your browser and navigate to http://localhost:8070/ you will see it is running there:
Odoo V9 alternative port
This issue comes form installing the postgres package with out a version number. Although postgres will be installed and it will be the correct version the script to setup the cluster will not be run correctly. It's a packaging issue. If your comfortable with Postgres there is a script you can run to crete this cluster and get postgres running however if your like me then you do it the easy way. First purdge the old postgres install. The issue currently lies with 9.1 so I will assume that's what you have installed
sudo apt-get remove --purge postgresql-9.1
Now simply reinstall
sudo apt-get install postgresql-9.1
Note the package name with the version number. HTH.
I have installed odoo using http://openies.com/blog/install-openerp-odoo-9-on-ubuntu-server-14-04-lts/ got no issue with the fresh ubuntu 14.04 LTS.
But, you need to check that there is no postmaster.pid in your postgres directory, probably /usr/local/var/postgres/
Remove this and start server using
rm /usr/local/var/postgres/postmaster.pid
It should work.
Check this to install odoo 10 in ubuntu 16.04 LTS
Bitnami ODOO, easy to install in your Machine.
Download from Here
It is compatible with preinstall postgresql.
As mentioned before you can use one simple script to install Odoo of any version (9, 10, 11).
Follow the steps:
Log in to your system and work as an superuser: sudo su
Update the system: apt-get update
Download the script. You can change to the version of your choice:
wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh
Run the script: ./odoo_install.sh
Now you can access Odoo at http://serverIP:8069
If you are running it locally that would be 127.0.0.1:8069
The next steps would be to configure the Apache/Nginx or another server to point a domain to the Odoo instance. Also, remember to set the proper access rules on your server (for example on Amazon that would be by opening the port 80 and 8069 in the security rules). It is also wise to change the default password in Odoo config from admin to something more secure.
If you used the script without editing your Odoo config file would be installed in /etc/odoo-serfer.config. Use nano, vi or another editor to change the default settings.

Postgres cant connect to server: No such file or directory

I'm running Debian server and use SSH to manage it. Today I tried to install Postgres and follow this steps to do it:
apt-get install postgresql
su - postgres
psql
After the last command I got:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I found several solutions in the Web, but all of them doesn't works for me. As example I found, that I need to delete "postmaster.pid" in here:
/usr/local/var/postgres/postmaster.pid
But I have no such directory as "postgres" in my "var" folder...
Please, help...:(
What you did is correct and normally sufficient except when something goes wrong with the automatic creation of the first cluster by apt-get install postgresql. Often there is an error message like this in the middle of the success reports:
Error: could not create default cluster
Since you can't have done any work with postgres yet, purge the packages with
apt-get purge 'postgresql*'
then reinstall with
apt-get install postgresql
but this time, pay close attention to any error message that would imply that the initial cluster was not created, that will give the actual reason of the problem.