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

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.

Related

Create Databse in Windows from command-line or VBScript?

How to create a new database for PostgreSQL 10 (pgAdmin 4) from command-line or VBScript in Windows?
I used the following command from command-line:
pg_dump --dbname=postgresql://postgres:123#localhost:5432/myDB --format=p --clean
But it returned the following error:
pg_dump: [archiver (db)] connection to database "myDB" failed: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
How to run the server in "localhost" (127.0.0.1)? How to fix this?
EDIT:
Furthermore, I also tried this,
createdb --dbname=postgresql://postgres:123#localhost:5432/myDB --format=p --clean
And got this error,
createdb: illegal option --
dbname=postgresql://postgres:123#localhost:5432/myDB
Try "createdb --help" for more information.
I found the solution at here thanks to Jasen and Mladen Uzelac. This is the command-line to create the database,
cd "C:\Program Files (x86)\PostgreSQL\10\bin"
psql -c "CREATE DATABASE mydb" "user=postgres dbname=postgres password=something_secret"

Can't connect to mssql server on ubuntu because script is in upgrade mode

When I want to login as 'sa' user in my mssql server by this command:
sqlcmd -S localhost -U sa
I got this error:
'Reason: Server is in script upgrade mode. Only administrator can connect at this time..'
I read about -T902 parameter, who is connected to this problem, but don't know how to start mssql server with that paramater in Ubuntu, if it's needed. I also ran mssql-conf script and choose 2) Developer option and setup a password for 'sa' user. I also use DBeaver tool. What shall I do? Thx in an advance.
System:
Ubuntu 17.10
SQL Server (latest version) - 14.0.3022.28-2
Dbeaver - 4.3.5

Remote connection to SQL Server with FreeTDS and IPv6

I am trying to connect to a remote SQL Server 2008 from a bash file in a Ubuntu 14.04. I am using FreeTDS and the tsql command to do so.
When I am in the same network as the SQL Server, I can access it using its local ip 192.168.0.2, using the following command:
tsql -S 192.168.0.2 -U <user> -P <password>
The problem is when I try to connect using an IPv6. tsql doesn't seem to recognize the IPv6 I got. Here is what I get when trying to connect (the ip is anonymized):
tsql -S fe80::c74a:ada5:be2e:255f%11
Here is the result:
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
What am I doing wrong here? Any help is appreciated
The problem was that I was using freetds v0.91 (which was the latest version on apt-get), which does not have support for IPv6. I upgraded to the latest version, which can be found here. Any version above v0.95 should be fine.

Apache2 Ubuntu Server Failed to connect to localhost port 5984: Connection refused with CouchDB

I have an Apache2 Ubuntu Server that is running and want to replicate my couchDB database locally to remote on the server. With terminal curl from this documentation on how to replicate. I performed this:
curl -X POST -d '{"source":"http://127.0.0.1:5984/demo","http://server_IP_here/":"demo"}' \http://127.0.0.1:5984/_replicate
The error comes up everytime. Is there something wrong with the above statement?
The server IP has doesn't require ports as a side not.
curl: (7) Failed to connect to 127.0.0.1 port 5984: Connection refused
Try to use port 8092
I couldn't found documentation on this, though random trying different ports found that my couchbase instance answer there :)

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