Majesty
Majesty

Reputation: 1909

Connect to PostgreSQL via PhpStorm

I have started learning the PostgreSQL and can't get how can I connect to database via PhpStorm. It always asking for password, but, as I understood, there is no password.

Right now I'm able to connect postgres server like that:

sudo -i -u postgres

I'm able to create new user, role, db and etc. Any ideas?

P.S. Using Ubuntu, if it's necessary

Upvotes: 0

Views: 2152

Answers (1)

Majesty
Majesty

Reputation: 1909

The solution is available via https://help.ubuntu.com/stable/serverguide/postgresql.html

To resolve this problem we need to change the authentication method. So the steps is:

Firstable, add new password for postgres, using this:

sudo -i -u postgres
psql
ALTER USER postgres with encrypted password 'your_password';

Then, open the configuration file

sudo nano /etc/postgres/9.x/main/pg_hba.conf

(Replace 9.x with your version of postgre)

Change this string

local   all             postgres                                peer

to

local   all             postgres                                md5

and for the last:

sudo service postgresql restart

And you are there.

Upvotes: 1

Related Questions