SQL shell (psql) permission denied - postgresql

Before i ask you a question please understand if my question is not well asked. This is my first time using psql. Well, i tried to start the server with shell and there isn't any other databases as you see and they are all default. However it doesn't ask me for password and it occured an error as you see in the code. what do i have to do to fix this issue?
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
find: /c/pagefile.sys: Permission denied

Just open sqlshell in administrator. My problem solved by this.

Related

Error while using createdb command postgresql on windows 10

I am a new user of PostgreSQL, and I am learning it so that I can use it with Django, so I am trying to use the createdb command to create a new database, but even though I am entering the correct password for my account, I am getting this error. I reinstalled everything and checked everything I could think of but I was not able to solve this error. So, if I can get some help regarding this issue it would be nice.
Even using the command psql, and submitting the correct password, gives the same error.
I am using Windows 10.
As far as I checked, I needed to enter the password I used while installing PostgreSQL.
By the way, I am using the latest version of PostgreSQL 14.1
The command I used:
createdb testdatabase
createdb: error: connection to server at "localhost" (::1), port 5432 failed:
FATAL: password authentication failed for user "<username_placeholder>"
So, basically, I figured the solution myself. I am just posting it here because mostly answers are available for Linux and not Windows. So, if a windows user has a similar problem, maybe this answer could help them.
So, the first thing is, if you need to open psql, use the command:
psql -U postgres
and then enter the password you used while installing PostgreSQL. Now, if you wish to do something similar to what I tried, what I mean is to use createdb command in the terminal itself, then you will have to create a new user using the same username as you do for your PC, like in my case, it is aryan.
(For example: C:\Users\aryan\).
I followed instructions from this website.
I personally used pgAdmin 4 to do it, you could also use the SQL commands themselves.
After doing everything, when I used the createdb command directly from the terminal/powershell, it asked my the password which I had used to create the other user( with the same username as my system/pc) using pgAdmin 4. That's it. This helped me out.

FATAL: password authentication failed for user postgres [SQL State=28P01]

So I'm using postgresql 13 and SQL Workbench on Windows 10 for the first time. I'm trying to connect the database to the server to no avail. I keep getting this error message: FATAL: password authentication failed for user postgres [SQL State=28P01]. From Stack Overflow and other documentation, I'm able to gather things about older versions of postgres or how to address this issue in Ubuntu and/or from the command line. But I have yet to find a remedy that fits my specific circumstance. Anyone have tips on how I can fix this or even better search terms that point towards a more precise solution? Let me know. Thanks!

Problems with postgres database in redmine after change in password

First, I'm a total newbie and I guess that's why this error occurred in the first place.
A colleague of mine stopped working and so I had to take over administrative stuff as the redmine we use and making backups.
So I wanted to schedule these backups automatically. Somewhere on the way I changed /etc/postgresql/9.1/main/pg_hba.conf for user postgres (that's the one for the redmine database.
from local all postgress peer to local all postgress trust so I could run a shell program in crontab. This worked but then redmine doesn't work anymore. I get this:
FATAL: password authentication failed for user "postgres" FATAL:
password authentication failed for user "postgres" (PG::Error)
On this the error site for redmine. I changed everything back and restarted everything, but it did't work.
Then I used an older backup to restore but still.
So, now I have no idea whats wrong. Maybe someone can help me.
Thanks.
Barbara
I think it is because I've changed the password of the postgres user in ubuntu. I did not know at the moment that they are connected. I always got a password promt but I didn't know it (my colleague at least didn't tell me one) I've tried to change it in the data base as well with
ALTER USER Postgres WITH PASSWORD 'newpassword';
Would it be enough to reinstall the database and use an old backup?

Error connecting to the Server in postgreSQL

I am trying to add a connection to the server in postgreSQL. But when I fill all the details I get this error
Error connecting to the server: FATAL: role "abc" does not exist.
"abc" is the username I want to create.
I am using Tomcat server eclipse for this.
Please help me find a solution to this problem.
Thanks in advance!
If the user does not yet exist, you will have to login as the admin and create it before you can login as that user.

Getting "Access is denied" error when executing pg_dump on Windows

I'm trying to execute pg_dump for one of my PostgreSQL databases, but I am having permission problems.
C:\Windows\system32>pg_dump -U postgres -p 1863 -O social_sense > C:\\Program Files\\PostgreSQL\\8.4\\data\\social_sense.sql
I am getting the following error:
Access is denied
Can anyone enlighten?
I apologise for taking up your time. It was due to that there is no write permission to the directory i was writing to.
Or you can run the cmd as administrator. In my situation that solved the problem too. I know it is a bit late answer but I thought, it would help someone else maybe