psql: error: FATAL: password authentication failed for user "Davinci" - database

Im trying to setup postgres database for my django project, so i donwnloaded the installer together with the pgadmin. i set a default password when installing and i used it to login to the pgadmin and it worked, i now wanted to run so cli commmand, so i added postgres to path in my system enviroment variable in other to be able to run it on the cli and it works, i mean the system recognise the commands but im getting errors which i think its comming from the database itself. i have no idea about this error, this is my first time using it.
PS: it asked for my system user password and i entered it, then i got the error bellow.
C:\Users\Davinci>psql
Password for user Davinci:
psql: error: FATAL: password authentication failed for user "Davinci"

Try running psql -U postgres and then inserting the password you chose at pgadmin.
User postgres is the default, but it seems like Windows is trying to run psql -U Davinci when you type only psql, so you have to specify which user (-U for user / postgres for the username) when trying to connect.

Related

Why is access denied for sudo user to run an update.php in mediawiki maintenance?

I'm a mediawiki admin, I have all the rights granted on the Database, I am a registered sudo user and when I try to run an update command it says: Wikimedia\Rdbms\DBConnectionError from line 1460 of /home/user/mediawiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Access denied for user 'user'#'localhost' (using password: YES) (localhost).
I have tried to sudo this command. I am a registered sudo user, I give my password correctly and then the same error pulls up like "access denied for user". I have installed a Patroller extension, I have edited the LocalSettings etc, the last thing I must do according to the guide is to run a php update.php. Since I am unable to do so, I always end up with this error message inside my mediawiki page when I click on "patrol edits": Fatal exception of type "Wikimedia\Rdbms\DBQueryError". So, my sql table hasn't been updated with the patrol extension because I cannot run the update command from my PuTTy.

Cannot boot Chainlink: opening db: failed to open db:

When I "chainlink node start",
I get the error:
"Cannot boot Chainlink: opening db: failed to open db: failed to connect to host=/private/tmp user=myname database=: server error (FATAL: unrecognized configuration parameter "?application_name" (SQLSTATE 42704))"
I follow this youtube video: https://youtu.be/ZB3GLtQvgME?t=2017
I have a .env
but it is not reading from there.
No matter what I change on DATABASE_URL,
I get the same error.
ETH_URL=wss://kovan.infura.io/ws/v3/
FEATURE_EXTERNAL_INITIATORS=true
LOG_LEVEL=debug
ETH_CHAIN_ID=42
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*
DATABASE_URL=postgresql://localhost:5432/kovan_demo?sslmode=disable
DATABASE_TIMEOUT=0
FEATURE_FLUX_MONITOR=true
MINIMUM_CONTRACT_PAYMENT=0
CHAINLINK_DEV=true
The database parameters are set via environment variable
As Richard said, you need to set DATABASE_URL as an environment variable. For some reason, the chainlink client cannot read file .env and set the environment variable as expected.
The way how I solve the problem is to set DATABASE_URL as an environment variable explicitly by command:
export DATABASE_URL=postgresql://<usrname>:<passswd>#localhost:5432/chainlink_node?sslmode=disable
You can find all configurations of Chainlink node here.
Hope it helps.
The format to connect to the database is the following:
DATABASE_URL=postgresql://$USERNAME:$PASSWORD#$SERVER:$PORT/$DATABASE
I always follow this steps to create the database:
sudo -u postgres psql
create database $DATABASE;
create user $USERNAME with encrypted password '$PASSWORD';
grant all privileges on database $DATABASE to $USERNAME;
Just change the variables
sudo -u postgres psql
create database chainlink;
create user username with encrypted password 'pass';
grant all privileges on database chainlink to username;
And then:
DATABASE_URL=postgresql://username:pass#localhost:5432/chainlink?sslmode=disable
I don't recommend at all this credentials for production.

How can I run pg_dumpall with Heroku?

How can I use pg_dumpall with Heroku? The default "database backup" feature from Heroku is pg_dump with the click of a button, which doesn't include roles, so I want to do pg_dumpall ... I'm trying pg_dumpall -h myherokuurl.compute-1.amazonaws.com -l mypassword -U myUser > dump.sql
I'm getting this error:
pg_dumpall: error: query failed: ERROR: permission denied for table pg_authid
pg_dumpall: error: query was: SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolconnlimit, rolpassword, rolvaliduntil, rolreplication, rolbypassrls, pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, rolname = current_user AS is_current_user FROM pg_authid WHERE rolname !~ '^pg_' ORDER BY 2
My first thought was to create a new user with the correct privileges. So, I logged using heroku pg:psql DATABASE -a my-app-name then tried create user myUser with password 'mypassword' but got the error ERROR: permission denied to create role
I'm honestly not sure what's going on I'm kind of just guessing. Any troubleshooting ideas would be appreciated! (in the meantime I'm just trying to learn more about Postgres)
If your problem is just about the pg_authid catalog, you should be able to use recent versions of pg_dumpall with the --no-role-passwords option.
This commonly works in hosted environments where pg_authid is inaccesible, e.g. on AWS. The only downside is that the passwords of Postgres users will be missing from the dump.
However, you appear to have a more limited, perhaps shared environment, where you can't even create new Postgres users. I am not certain if there is any chance to get pg_dumpall working there.

Plesk Maria DB admin password changed after upgrade from 5.5 to 10.2

I've upgraded MariaDB from 5.5 to 10.2 (on CentOS 7.7) following this tutorial: https://support.plesk.com/hc/en-us/articles/213403429
MariaDB 10.2 is running. User/Websites can connect to their databases. But I can't connect with admin anymore.
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --all-databases --routines --triggers > /tmp/all-databases-new.sql
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'admin'#'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
I tried to set a new password for admin but...
systemctl stop mariadb
[root#host ~]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 76597
[root#host ~]# 200317 08:23:11 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
200317 08:23:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[1]+ Done mysqld_safe --skip-grant-tables --skip-networking
[root#host ~]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
It's no longer possible to access the Plesk GUI because Plesk can't access the psa database anymore. What to do now?
Many thanks in advance!
The reason why "mysqld_safe --skip-grant-tables --skip-networking &" failed was, that Mariadb could not write the pid-file. Mariadb tried to write it it in /var/run/mariadb but that directory was non existent. You can create the directory or change the configuration, so that Mariadb uses another directory for the pi-file. After that it was possible to execute "mysqld_safe --skip-grant-tables --skip-networking &" and to set a new password for the database user "admin".
For all internal purposes, Plesk gets the database password from /etc/psa/.psa.shadow. So I put it in plain text, which works but of course plain text is bad. Does anybody know how to store the password as hash again? I think it was stored as AES128 hash, which needs the right secret?

Unable to connect to postgres database through heroku

I have a postgres database that I created through heroku. I am trying to access it through psql with the command:
cse-190-fortune matanvardi$ psql "dbname=dccemfsa6camml host=ec2-54-235-152-226.compute-1.amazonaws.com \
user=tfmfbqxqjznsbl password=********* port=5432 sslmode=require"
I get this error:
psql: could not connect to server: Operation timed out
Is the server running on host "ec2-54-235-152-226.compute-1.amazonaws.com" and accepting
TCP/IP connections on port 5432?
I've cloned the repository and I'm logged in, I simply cannot figure out what is wrong here. Any help would be greatly appreciated.
To access your Heroku database from the command line use the command:
heroku pg:psql
Edit:
I ran your command from my machine. If course I don't have your password but I got:
$ psql "dbname=dccemfsa6camml host=ec2-54-235-152-226.compute-1.amazonaws.com user=tfmfbqxqjznsbl port=5432 sslmode=require"
Password:
psql: FATAL: password authentication failed for user "tfmfbqxqjznsbl"
Which means I was able to connect, which is farther than you got. It must be a problem with your network setup.

Resources