Unable to connect to postgres database through heroku - database

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.

Related

snowflake snowsql Error 250003 (n/a): Failed to execute request: HTTPSConnectionPool(host='https Failed to establish a new connection

encountering Error while try to connect using CMD (Admin)
250003 (n/a): Failed to execute request: HTTPSConnectionPool(host='https Failed to establish a new connection.
Snowflake account is on Azure.
Thanks in Advance
Based on your comment, the problem is when using the account option:
>snowsql -a XXXX.west-us-2.azure.snowflakecomputing.com -u username
The account should not include this part .snowflakecomputing.com, so your call should be:
>snowsql -a XXXX.west-us-2.azure -u username
I also faced the same issue while giving the hostname as https://xxxxxxxx.us-east-1.snowflakecomputing.com, then I removed https://. It connected successfully.

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?

Connect to MS SQL Server on Arch Linux

I installed on my arch machine mssql-server and mssql-tools via yaourt. I started the server from /opt/mssql/bin/sqlservr and tried to connect with my credentials, but with no luck. I found this article which says to connect with the command sqlcmd -S localhost -U SA -P 'YourPasswordHere', but it didn't work either. The error message says:
2017-07-06 21:57:28.25 Logon Error: 18456, Severity: 14, State:
7.
2017-07-06 21:57:28.25 Logon Login failed for user 'SA'. Reason:
An error occurred while evaluating the password. [CLIENT: 127.0.0.1]
I tried with blank password, with Password123 and with my user's password but the message was the same.
Has anyone managed to connect and if yes what was the default password?
Please let me know if you need any further information.
Thanks.
I found it. I had to run this command sudo /opt/mssql/bin/mssql-conf setup in order to set the password for the SA user. Now I can connect.

Connecting to Google Cloud SQL from External Applications

I've followed the instruction: https://cloud.google.com/sql/docs/external
STEP1. $ chmod +x ~/GCP/cloud_sql_proxy
STEP2. $ gcloud auth application-default login
STEP3. $ ./cloud_sql_proxy -instances=[INSTANCE_CONNECTION_NAME]=tcp:3306 -credential_file=[PATH_TO_KEY_FILE]
I got 2016/12/15 19:55:44 Ready for new connections
STEP4. $ mysql -u root -h 127.0.0.1 -p
But I got the following error in the Terminal;
2016/12/15 23:51:20 New connection for "[INSTANCE_CONNECTION_NAME]"
2016/12/15 23:51:20 Thottling refreshCfg([INSTANCE_CONNECTION_NAME]): it was only
called 23.918136971s ago
2016/12/15 22:08:26 couldn't connect to "[INSTANCE_CONNECTION_NAME]":
Post https://www.googleapis.com/sql/v1beta4/projects/{PROJECT_ID]/
instances/[INSTANCE_NAME]/createEphemeral?alt=json: private key should be a PEM or
plain PKSC1 or PKCS8; parse error: asn1: syntax error: sequence truncated
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial
communication packet', system error: 0
I am stuck here.
Appreciate for all your help.
Did you create a service account with Editor role and download the private key?

psql: server does not support SSL, but SSL was required

Trying to connect to postgresql server using command prompt.
Command used:
psql "sslmode=require host=localhost dbname=test"
Error thrown:
psql: server does not support SSL, but SSL was required
Please help me out on this.
Thanks.
This link suggests that you might try
psql "sslmode=disable host=localhost dbname=test"
or (probably better)
psql "sslmode=allow host=localhost dbname=test"
That way you should be able to connect to your server.

Resources