postgres 13, terminal(psql) closes after asking for password - postgresql

I've just installed postgres 13 and am trying to learn it for the first time. (windows) During the installation process I was prompted to create a password.
Now when I try to open up the psql terminal I'm immediately prompted enter a password.
After I enter the password the terminal just closes for some reason and nothing further happens.
From what I gather on-line, some are saying this is due to postgres using my 'windows user login' as it's user?
I'm not sure what the fix is for this or how to go about using postgres from here.
Does anyone have any insight?
Explain it to me like I'm 5 please.

As talked about in the comments, the solution was to open psql.exe from cmd.
The reason the terminal was closing was due to a password Auth error.
From there I was able to call the .exe with the appropriate options.
eg
psql.exe -d postgres -U postgres
I found that from this answer:
In PostgreSQL why does command line window disappear when I press Enter after entering my password?
The problem was that the shell will by default try and use the windows user as the log in ID, and the password you type will be incorrect for that log in ID.

Related

postgres is not in the sudoers file. This incident will be reported

If the error occurs when trying to create PostgreSql Role This error occurs because you are inside the postgresql.
You need to change to root user, for that you need to type in the terminal,
su root
Next run the command,
sudo -u postgres createuser --interactive
Your question is hard to follow, as it reads like you are just quoting someone else, but it isn't clear who or why.
The way this usually happens to me is that initially I am logged in as a user who does have sudo powers (my normal daily user account), but then I change into "postgres" Linux user by executing sudo su - postgres. But once there, I then try to execute some sudo command, but since logged in as postgres and postgres does not have sudo powers, I get this error. I fix the error by exiting the shell which is logged in as postgres, and so dropping back to my regular account, before repeating the sudo attempt.

Grafana-cli admin reset-admin-password access is denied

I'm running grafana locally on my windows 10 computer using the grafana-8.0.2.windows-amd64 installer.
I'm having issues resetting my password - username: admin password: admin doesn't work and I don't remember what I set it to. I've navigated to the /GrafanaLabs/grafana/bin/ folder in the command prompt and run the command: grafana-cli admin reset-admin-password 'admin'
which returns ←[31mError←[0m: ←[31m✗←[0m failed to load configuration: failed to initialize file handler: open C:\Program Files\GrafanaLabs\grafana\data\log\grafana.log: Access is denied.
I've read so many potential solutions and tried the SQLite one referenced here - https://community.grafana.com/t/how-do-i-reset-admin-password/23/2 and while this doesn't give me an error message, it does not allow me to log in even after restarting the Grafana in "Services" through the OS.
Very simply, you need to run the command prompt as an administrator. The above instructions will work as is but the password will literally be 'admin' rather than admin. Use double quotes if you wish to have spaces in your password as shown below.
grafana-cli admin reset-admin-password "admin password"

Create user on Postgres 9.5 using FreeBSD and Vagrant

I am trying to create a user in Postgresql 9.5 on FreeBSD 11. I am also trying to automate the whole thing with Vagrant and I have almost succeeded except for the creation of the user. I am using the createuser command with a password, and with that, I have attempted to use expect command in order to send the password to the prompt but I continue to receive the following error message:
"default: createdb: could not connect to database template1: FATAL: role "root" does not exist"
Here is the code sample that I am using:
# Create the database and the user
PASS=password
expect << EOF
spawn createuser -sdrP capstone
expect "Enter password for new role:"
send "${PASS}\r"
expect "Enter it again:"
send "${PASS}\r"
expect eof;
EOF
I am not too sure what else to try in regards to overcome this error, any help would be appreciated.
Do not run this script as root.
By default user "pgsql" has the permissions.
Switch to user:
su -l pgsql
Then run your expect script.

Unable to run OTRS daemon, OTRS6 on Cent OS 7

I am facing issue while trying to start ORTS daemon on CentOS linux
FACILITY:
OTRS-otrs.Daemon.pl - Daemon
Kernel::System::Daemon::DaemonModules::SystemConfigurationSyncManager-07
MESSAGE:
Access denied for user 'otrs'#'localhost' (using password: YES)
When I am trying get the status using command:
./opt/otrs/bin/otrs.Daemon.pl status
getting this message:
Manage the OTRS daemon process.
Daemon running
But when I go to the web page it says that OTRS Daemon is not running.
Any help is appreciated!?
The error comes from the mysql daemon and has nothing to do with Perl. Try this on the command-line on the server running otrs:
mysql --user=otrs --host=localhost --password=XXXXXXX
That will probably fail with the same error. Once you have fixed your mysql configuration so that the command succeeds, otrs should also start.
Omit the option --password and let mysql prompt you for the password, if you are not alone on the machine.
Another reason for the failure could, of course, be that you have misconfigured otrs, and you have to change the mysql user, host, or password.
After searching for solution for two days i finally get it working.
I first change to /opt/otrs/bin/ directory.
To get the daemon working, you have to start the daemon as otrs user.
To do that just change user to otrs : you can use this command. (su otrs) from your terminal, you will be prompted for the password for otrs. Just enter the password and use the (whoami) command to check if you are otrs. If it shows that the current user is otrs issue this command (./otrs.Daemon.pl status) to see the current status of the daemon. if it shows that the daemon not running then issue this command (./otrs.Daemon.pl start).

Running PGAdmin after Silent installation, what is the login?

I started an installation of Postgres in unatended mode with the commandline:
postgresql-9.5.2-1-windows-x64-x64.exe --unattendedmodeui minimal --mode unattended --superpassword "password" --servicename "postgreSQL"
--servicepassword "password" --serverport 5432
After the installation is finished i want to login to the database with pgadmin. i tried with "password" but i get the error:
fatal password authentication failed for user postgres
so what are my login data for the installed database?
Thanks a lot
Marcel
If you don't know the password you have to change the pg_hba.conf file that contains all the authentication information.
You can read about how it works here:
http://www.postgresql.org/docs/devel/static/auth-pg-hba-conf.html
I suggest you to create a backup of the original file first and to reboot the server after changes.
I was facing the same issue. It looked like there was a conflict with previous installations of Postgres.
I could login using the password specified by --superpassword after cleaning all Postgres-related folders in program files as well as in custom install locations.
A professional approach would be running your installer on a clean system or a VM.