Cannot connect to local host in Postgres - database

Trying to run PostGraphile locally, but whenever I run psql "postgres:///", it queries me for a password for a user, I enter the password, and it says it's wrong, though I know I entered it correctly.
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "username"
But when I run:
ALTER USER 'username' PASSWORD 'password'
It doesn't return any errors. But then when I try to run psql "postgres:///" again, and when it queries me for the password, it still doesn't work even with the reset password.

Related

heroku pg:push error with unexpected arguments - how to fix?

I am facing an issue when trying to run the command heroku pg:push postgres DATABASE_URL --app pyprodjangompz.
I get an error message saying
pg_dump: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "Usuario"
However, "Usuario" is not the name of my user in the local database. In my Docker information, it shows that the user name is "pythonpro" with password "pythonpro".
How can I resolve this issue and push my local database to Heroku?

NodeJS OracleDB connection string

I am running Oracle XE 21c in a Docker container and I can connect to it with a JDBC thin connection using the JDBC url jdbc:oracle:thin:#localhost:1521:XE using the SYSTEM account. I can also log into the terminal Docker instance and connect to the database fine.
When I try to connect to it using NodeJS OracleDB example code described here:
https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html, I cannot get the client to connect using either:
connection = await oracledb.getConnection({
user : "hr",
password : mypw
connectString : "localhost/XEPDB1"
});
or
connection = await oracledb.getConnection({
user : "SYSTEM",
password : "MyPassword",
connectString : "localhost/XE"
});
I get an error ORA-01017: invalid username/password; logon denied.
I can connect to Oracle XE using sqlplus either by logging into the Docker container or from the host Mac using:
sqlplus SYSTEM/Password#localhost:1521/XE
if I change the nodejs code to:
const connection = await oracledb.getConnection({
//user: "SYSTEM",
//password: "Password42",
//connectString: connectionURI.url
connectString: "SYSTEM/Password#localhost:1521/XE"
});
I get the error:
ORA-12154: TNS:could not resolve the connect identifier specified
Any ideas why I can connect with sqlplus but not NodeJS OracleDB?

Connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'#'localhost' (using password: NO)

I'am the new user of zabbix.
After updating zabbix (from Zabbix 4.0.8 to Zabbix 4.2.5) I had a problem with web-interface.
The frontend does not match Zabbix database. Current database version (mandatory/optional): 4000000/4000006. Required mandatory version: 4020000. Contact your system administrator.
I opened a log file and found:
10344:20221123:151903.222 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'#'localhost' (using password: NO)
10344:20221123:151903.222 database is down: reconnecting in 10 seconds
I checked /usr/share/zabbix/conf/zabbix.conf.php
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'password';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix-test';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
If I login in mysql with password, it works.
mysql -u zabbix -h localhost --database=zabbix -p
Without password it doesn't work.
mysql -u zabbix -h localhost --database=zabbix
ERROR 1045 (28000): Access denied for user 'zabbix'#'localhost' (using password: NO)
As I understand, the problem is that zabbix doesn't use the password during logining.
I have tried:
mysql> grant all privileges on zabbix.* to zabbix#localhost;
Tried to update proxy:
apt-get install --only-upgrade zabbix-proxy-mysql
0 upgraded, 0 newly installed, 0 to remove and 109 not upgraded.
zabbix_server.conf has been changed after updating of zabbix.
I found out that my DB password was commented out.
DBUser=zabbix
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword
I wrote the password and it works.
DBPassword=yourpassword

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. ClientConnectionId:

I'm trying to connect to microsoft sql server using 8.2 version of jar.
It works fine when I'm using the same username, password in DBeaver. I'm not using any additional options in the connection string of DBeaver. I'm using the type SQLServer Authentication. It gets connected in DBeaver but I'm not able to open a connection via Scala repl.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")
val props=new java.util.Properties
props.put("user","")
props.put("password","")
// URL : jdbc:sqlserver://host:port // No additional options like in DBeaver
DriverManager.getConnection("url",props)
Error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'USERNAME'. ClientConnectionId:CONNECTIONID
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:283)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:129)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:37)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:5173)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3810)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:94)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3754)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7225)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3053)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2562)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2216)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2067)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1204)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:825)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
... 47 elided

strapi Error connecting to the atlas Mongo database

I want to use mongo atlas with strapi. SO I am reading the values from .env
these are the settings
connections: {
default: {
connector: 'mongoose',
settings: {
host: env('DB_MONGO_URL', '127.0.0.1'),
srv: env.bool('DATABASE_SRV', false),
port: env.int('DB_PORT', 27017),
database: env('DATABASE_NAME', 'mydb'),
username: env('DB_USER_NAME', null),
password: env('DB_PASSWORD', null)
},
options: {
authenticationDatabase: env('AUTHENTICATION_DATABASE', null),
ssl: env.bool('DB_SSL_ENABLE', false),
},
},
and here are the values
DB_MONGO_URL=myproject.random.mongodb.net/mydbt?ssl_cert_reqs=CERT_NONE
DB_USER_NAME=myuser
DB_PASSWORD=mypasswor
but this is showing
[2021-10-12T13:18:25.485Z] debug ⛔️ Server wasn't able to start properly.
[2021-10-12T13:18:25.490Z] error Error connecting to the Mongo database. Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
error Command failed with exit code 1.
In network i have allowed, 0.0.0.0 that includes any IP address.
If i pass this url in MongoDB Compass
mongodb+srv://myproject.random.mongodb.net/mydbt?ssl_cert_reqs=CERT_NONE
then this works
I tried the same as well
DB_MONGO_URL=mongodb+srv://myproject.random.mongodb.net/mydbt?ssl_cert_reqs=CERT_NONE
DB_USER_NAME=myuser
DB_PASSWORD=mypassword
but this shows
[2021-10-13T06:59:01.372Z] debug ⛔️ Server wasn't able to start properly.
[2021-10-13T06:59:01.374Z] error Error connecting to the Mongo database. getaddrinfo ENOTFOUND mongodb+srv
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If i tried enable srv true
[2021-10-13T07:01:20.065Z] debug ⛔️ Server wasn't able to start properly.
[2021-10-13T07:01:20.067Z] error Error connecting to the Mongo database. URI does not have hostname, domain name and tld
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
how can i solve this?

Resources