I just installed postgres through Terminal and when I try to createdb "test" I allways get this error:
createdb: could not connect to database template1: FATAL: password authentication failed for user ""
I know there are a few threads already on this topic but nothing works. Most suggestions were to update "pg_hba.conf" but I'm doing it wrong or there is something else... I also tried to remove the postgres password but it doesn't work... nothing seems to work...
Related
I am having a problem trying to run psql on my MacOs. The psql command returns the following error:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "luicruz"
How could I fix this?
I try to put my sudo password when the terminal request me the password, but it didn't work. The only password that works is for the default user "postgres" that I set the password when I install the app on my system.
I don't know why the user 'luicruz' was automatically created, I didn't create this user or set a password for this user.
And now I can't use the psql command.
Below is an image showing the login/Group roules of the Pg Admin 4 and also the return of the commands in the terminal
The problem is that the psql command needs to be used in addition to the database name, and I didn't know that. After creating the database, I was able to use the command apart from the psql command.
I did setup Postgres-12 on Centos AMI EC2, It works well.
However, Sometimes (my case is the next day) I can not connect my DB by trying
$psql -h XXXX -p5432 -Upostgres
A authentication failed error
psql: error: could not connect to server: FATAL: password authentication failed for user "postgres"
Next, I change my postgres user again by
$sudo su - postgres
~]$ psql -c "alter user postgres with password 'postgres'"
The connection login become work.
But sometimes it become not work again (same above authentication failed)
I reset postgres password the same above command => The connection login become work.
It repeats #2
I don't know why. Does anybody know that? What should I do?
I realize that the my Postgres use very much CPU (%CPU: 99%).
hat could be solution to this problem. I would appreciate any suggestions.
Thank you
I have installed PostgreSQL 10.0 on my Windows 10, during the installation it asked me to enter a password for root user and I have created one. I wanted to run it over the command line and have set environment variables, but when i try to launch it by typing
C:\Users\akhil\Documents\Flask Examples\postsql>psql sample.sql
Password:
psql: FATAL: password authentication failed for user "akhil"
I've seen some solutions to change the pg_hba.conf file but It couln't help me.
(update)
I've also tried to create a user id but it shows the same error
createuser akhil
Password:
createuser: could not connect to database postgres: FATAL: password authentication failed for user "akhil"
This should help you get in to your database.
psql postgres://username:password#ip_address/database < sample.sql
I have installed PostreSQL, I have the Heroku toolbox, and I'm still trying to just get started.
From my Windows command prompt, I type psql and it asks for a password, and I type in the one I provided when installing PSQL, and it still gives me:
C:\Users\Tina\Desktop\FriendActivity>psql
Password:
psql: FATAL: password authentication failed for user "Tina"
I have even tried:
C:\Users\Tina\Desktop\FriendActivity>psql -U postgres
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
This is a fresh install. First time trying to use it.
I was trying to follow these steps here:
https://devcenter.heroku.com/articles/heroku-postgresql#local-setup
but
export DATABASE_URL=postgres:///$(whoami)
does not work:
C:\Users\Tina\Desktop\FriendActivity>export DATABASE_URL=postgres:///$(whoami)
'export' is not recognized as an internal or external command,
operable program or batch file.
I have been trying to get this set up to use for a class project that uses a database for a few days now... and I cant seem to get this to work.
the project we are working on is here:
https://github.com/rwprice31/FriendActivity
My part is getting the database functionality working.
You are following instructions written for Linux or Mac OS X. They will not work on Windows.
The Windows equivalent of:
export DATABASE_URL=postgres:///$(whoami)
is
set DATABASE_URL=postgres://localhost/databasename
where you should replace databasename with the name of the database you wish to connect to.
As for:
> psql -U postgres
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
I can only assume that you made a mistake entering the password when you set it up, or you had an old PostgreSQL data directory already in place from a past install.
Either way, you'll need to reset the password. There are many instructions here for doing that, so I won't repeat them.
Regarding:
>psql
Password:
psql: FATAL: password authentication failed for user "Tina"
Presumably there is no user named Tina in PostgreSQL. The installer would usually only create a postgres user when installed.
Hi I've tried looking around for an answer but don't know how to access my local machine's postgresql username and password. I'm a big noob when it comes to the command line and bash and etc, so please help. Can someone help in helping me find out my username and password for postgres on a Mac?
Edmunds-MacBook-Pro:postgres edmundmai$ psql -d db -U postgres
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
I don't know of a way to recover a password from PostgreSQL. However, if you add local all all trust to your pg_hba.conf file, it will allow you to log into the cluster without a password from your local machine. Once you've made the change, restart the server to get it to take effect, and then you can log in and change your password. Once you're done, be sure to remove this line from your pg_hba.conf and restart the server, as this isn't particularly secure.