I am pretty new to postgreSQL. I am running version 9.5 of it on my main machine. I am trying to establish a telnet connection from my virtual machine. Before doing that I have configured the postgresql.conf and pg_hba.conf files to accept connection from remote machine in the same network.
However when I start the postgresql service using:
service postgresql start
The process show the status:
active(exited)
and the telnet connection is also refused(when i run telnet x.x.x.x 5432). Also when i start the postgresql service using
systemctl start postgresql#9.5-main
the status is active(running) but the telnet connection is still refused. Can anyone tell me how to establish the telnet connection? I dont really know whats going on and I am new here so please dont mind if its a noob question
Related
I have a SQL Server - Developer edition - hosted on an Ubuntu 20.04 Lightsail instance in AWS. I have a static IP configured, and I have my ports opened up on 1041 to allow traffic to the server. I am able to SSH into the server remotely, and I can see that the 1041 port is open - however, any time I try to connect to the server through SSMS, I'm unable to actually connect to it, with the error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TC Provider, error: 0 - The wait operation timed out.) (Microsoft SQL Server, Error: 258)
I'm able to run commands using /opt/mssql-tools/bin/sqlcmd -S localhost,[myPort] -U [myUsr] -P [myPwd] -Q "[myQuery]", so I know the server is up and running, and responsive.
I've validated that the server is listening on the SQL Server port by calling netstat -tunlp, and seeing that the port is in the LISTEN state.
I've validated that I have no additional Firewall running, so the only thing that should be blocking is the Lightsail Networking. I decided to go for broke, and opened up the server to all TCP traffic - which still got me nowhere.
I've checked to see that remote connections are allowed (they are) - but I have a feeling this is where my issue lies. I read that the command to allow remote connections is EXEC sp_configure 'remote access', 1 ; - I ran this, and rebooted and still nothing. Then I found out that that command isn't necessarily related to allowing remote connections TO the server, and it instead allows remote connections FROM the server.
Is there any other options/tools that I'm missing that I can use to allow remote connections to the SQL Server?
Edit 1 - Updating ipaddress in config
On the advice of #AlwaysLearning, I updated my mssql.conf file to explicitly list 0.0.0.0 as the ipaddress of the sql server.
When I did this, I restarted the mssql server, and it now crashes constantly. I removed the 0.0.0.0 address, but it looks like that was able to force mssql to start up listening under 0.0.0.0?
However, it is still unable to connect remotely. I noticed that when I run tcpdump -nn -i any port 1041, I DO see connections to it, but I DON'T see my attempts from my external connection to it. It looks like I'm listening correctly now, but I don't actually get any traffic to the server?
I would like to access a Azure SQL database. It is accessible on port 1433. However, the firewall is blocking this request. Therefore, I wold like to tunnel my connection.
Setup
The client is running on Windows 10. I can connect to a remote linux server. This server runs at home and when I'm at home, I am able to access the SQL database. So I assume my linux server is also able to connect to the Azure database.
Tunnel request?
I want to access the database via an ODBC connection. So, I tried to tunnel the connection using putty:
Putty connects to linux server and tunnels localhost:2433 to server-url:1433
Client connects to localhost:2433
Client has access to database
However, this is not working.
What goes wrong?
I am able to connect using putty to linux server.
I have setup a tunnel inside putty at the Connection > SSH > Tunnels page:
Source port: 2433
Destination: server-url:1433
I have set the radio buttons to Local and auto.
What goes wrong here? I don't know how I can investigate this properly. Maybe there is a problem at my linux server, that it can't connect to Azure SQL. But I think my tunnel is not working correctly. Can you help?
I didn't get it to work with putty, but if you have access to a shell you can use
ssh -L <local_port>:localhost:<remote_port> user#server -i "path to your private key file if you need one for authentification"
So in your specific example it would be
ssh -L 2433:localhost:1433 user#server-url
I used this to create an ODBC connection from RStudio (you can use the built in terminal to establish the tunneling) to a postgres db running in a docker container on azure.
I have been having troubles to establish database connection using the MS SQL Management Studio. It was working fine when I was using a local internet service provider. However, when I began to use the university internet, I am not able to connect to the db, although I sql-whitelist the ip. I have no ideas how to manage this issue. I have to connect to the db to manage it, but I am receiving "A network-related or instance-specific error occurred while establishing a connection to SQL Server..." Do you have any idea? Is this something that my hosting company should figure out?
Thanks!
There is a reasonably good chance you are being blocked by a firewall at the university. They probably block/allow based on IP. Universities should not allow all IP's in the University net to have access by default.
You may have had a firewall exception for the old address. You can check if port is blocked by using the telnet command from any windows client command line.
telnet 127.0.0.1 1433 -- substitute your sql server ip address or name
telnet 127.0.0.1 22334 -- no reason for the this port to be open
This is what a blocked port looks like
C:\>telnet localhost 22334
Connecting To localhost...Could not open connection to the host, on port 22334:
Connect failed
C:\>
If 1433 is open and associate with ms-sql you get a different behavior (although it is pretty odd) -- you may have to close the command prompt or kill the telnet process. In any case, this confirms the port is open or closed. If port is open and you can't connect, you have a connection string problem or something obscure.
I am currently setting up a postreSQL server on my Windows computer.
I want to create my first database, but couldn't create the createdb function due to a password authetification failed. Thus I found the following question on this website:
How to configure postgresql for the first time?
However, I think I forgot the ; at the end of :
ALTER USER postgres with encrypted password 'xxxxxxx';
And now, when I try to launch psql, I have the following errors:
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Active code page: 1252
psql: 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?
Press any key to continue . . .
Any idea of what I could do to solve the problem?
Do you think it is really the missing semi column that caused the problem?
Do you have any tutorial on how to setup a postgreSQL database on Windows? All the one I found until now were for Linux only.
The error you're getting appears to be from Postgres not currently running, rather than an authentication error as you're presumed. The PSQL client or whatever PG client you're using is attempting to establish a connection on the default port but nothing is there.
If Postgres isn't currently running, try finding it (Via CTRL-Alt-Delete). If it's running, try terminating it and starting it up again. Hopefully that fixes the problem... Otherwise your port 5432 might be blocked for some reason.
If all fails, I am still skeptical the parentheses could cause this error because it's not an authentication error. Try to reinstall Postgres with a clean install.
I am just wasting too much time with this issue. My final goal is to change the collation of the Amazon RDS DB from latin to utf8. To accomplish that, there is a lot of information out there, and yet, non of that has worked for me.
First of all I tried to prompt mysql:
mysql -h ###.###.us-west-1.rds.amazonaws.com -p --port=3306
but it raise an ERROR 2003 (HY000): Can't connect to MySQL server on '###.###.us-west-1.rds.amazonaws.com' (60)
If I try using telnet:
telnet ###.###.us-west-1.rds.amazonaws.com 3306
Trying 54.###.##.##...
telnet: connect to address 54.###.##.##: Operation timed out
telnet: Unable to connect to remote host
Looking at the aws.docs says that I have to authorize access to my cache cluster. But I could't get that far. I didn't know what to put on the Port rangeand Source by trying to add a new Custom TCP rule for my default security group. So I ended following this tutorial using mysqldump but I have the same connection problem as using >mysql
Any help would be really appreciated!