I manated to lock myself out of SSH on an Canonical-Ubuntu-22.04 SSH always free server. do anyone know how i can get access back?
PS C:\Users\mikel> ssh -i ~/.ssh/ssh-key-2022-10-19.key ubuntu#129.xxx.200.16
ssh: connect to host 129.xxx.200.16 port 22: Connection refused
ssh: connect to host 129.xxx.200.16 port 22: Connection refused
means the remote host is sending the reject flags back, it can be due to
firewall blocking ssh port
iptables blocking port 22
security groups (Ingress, egress) blocking port 22
First check if you have allowed port 22 in console, if yes
then login to instance via console connection and then try to debug 1,2 points
Related
There is a MySQL server running inside a VM(1) that do not have any port forwarding to public IP and can only be accessed inside the VMWare network. I have an ssh connection to a sibling VM(2) though which I can connect to the VM(1) and can also setup an ssh tunnel to it. How can I connect to MySQL on my local machine? I tried setting up a tunnel on VM(2) like this
ssh -fNTM -S $(dirname "$0")/tmp/$ENV-mysql-socket -L "$mysql":"$mysql_server" "$login"#"$ip" "$ENV.server"
But when I try to connect to it on my machine an error occurs:
handshake: reading initial communication packet
This site can’t be reachedlocalhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
This is the message that popped up
Please check the port first. Is your port is listening correctly or there may be a firewall preventing you to connect to that port.
You can use the following command to check the open ports
sudo netstat -tulpn | grep LISTEN
To check the specific port use
sudo lsof -i:22 see a specific port such as 22
As the title says I want to connect remotely to mysql and it is on windows server but I got this error message.
Cant connect to mysql server on X.X.X.X
I am tring it with HeidiSql
I have MariaDB installed.
Also I can connect to server using remote connection.
Server is running and can connect to mysql localy
What have I tried:
I located my my.ini file and checked that I dont have one of these commands:
Skip-networking
bind-address = some IP
I didnt have them there in the first place
I logged in my MariaDB terminal and granted all permisions to user using this:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'192.168.100.%'
IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;
I have added port 3306 to windows firewall
I guess it is worth mentioning that I cant ping that server either
if I do
ping X.X.X.X
it returns:
Pinging X.X.X.X with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for X.X.X.X:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
I have spent many hours on forums and tried all instructions but still cant connect.
Any help would be much appreciated!
The detailed problem can be from two different causes:
First option:
MySQL is binded to 127.0.0.1 or no ip at all. Check netstat on windows cmd for locating 3306 port opened to mysql process and binded to your network LAN interface or 0.0.0.0 (not to loopback / 127.0.0.1 // ::1)
For check netstat, use netstat -a -n -o, you can see in the response the PID of the process too.
For check MySQL is working on the same machine, try to connect from local console using mysql -h 127.0.0.1 (for localhost connection) or mysql -h (your LAN IP) (If you have mysql binded only to your LAN IP address).
Second option:
If first test are OK. Maybe windows firewall is not configured correctly. Try to disable windows firewall (double check disabling it). The error response on your question are because windows firewall are active and blocking connections. When you have verified you can reach 3306 with firewall off, enable it and configure. Check always you're opening the port on the required network profile (Remember, windows firewall can have different rules for private / public connections).
For check firewall correctly configured, try to access to the 3306 port on the computer from another comp on the LAN.
If you have a huge LAN network with VLANs and similar technologies, check your routing topology. Also, remember always for initial checks, disable windows firewall. Your ping are failing because firewall are enabled.
I am using PyCharm to connect to my local MySQL database running at localhost port 3306. Here's my JDBC url in the "Data Sources and Drivers" window as shown by PyCharm:
jdbc:mysql://localhost:3306/mydb
When I try to connect or click "Test Connection" I am getting this error in IntelliJ:
Error: Connection to MySQL failed.
Connection to Local MySQL failed.
[08S01] Communications link failure.
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
I can connect to mysql using the command-line client just fine, it's just PyCharm that's not working. What am I doing wrong?
Make sure your MySQL isn't listening on IPv6 address. For some reason IntelliJ/PyCharm has problems when connecting to MySQL running on IPv6 address.
To see what address your MySQL server is listening on, type:
$ ss -ntl|grep 3306
LISTEN 0 80 [::1]:3306 [::]:*
The [::1]:3306 part means it's listening on IPv6 address on localhost.
To change to IPv4, open /etc/mysql/my.cnf and add/set the bind-address parameter in [mysqld] section to 127.0.0.1 instead of localhost:
...
[mysqld]
...
port = 3306
bind-address = 127.0.0.1
...
Then restart mysqld.service and you'll be able to connect via IntelliJ/PyCharm.
I am trying to remotely connect to a MySQL server. I have followed advice from (1) and setup a user on the ip address I will be remotely accessing from.
user$ mysql -u TestUser -p -h 129.169.66.149
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '129.169.66.149' (60)
I have checked and the port (default, 3306) is correct and the ip address is correct. MySQL is also running.
From a remote computer, I can successfully ping the server
ping 129.169.66.149
64 bytes from 129.169.66.149: icmp_seq=48 ttl=63 time=1.010 ms
But when I use Telnet:
TELNET 129.169.66.149
Trying 129.169.66.149...
telnet: connect to address 129.169.66.149: Operation timed out
telnet: Unable to connect to remote host
Can anyone advise? Is this a firewall issue?
(1) - https://superuser.com/questions/826896/access-wordpress-mysql-database-remotely
First try to check TCP connection issue, using netcat and telnet : on the mysql server, stop mysqld (to release port 3306) and run netcat on listen mode :
nc -l -p 3306
Now, netcat is listening port 3306 (like mysqld does when it's running) and will show what happen on that port (incoming connections, what's in the wire...).
On your remote computer (mysql client), try to connect to the mysql server host :
telnet 129.169.66.149 3306
or :
nc 129.169.66.149 3306
If this is not working, this is not a mysql server configuration issue but a network issue, and you must check your router firewall rules.
Otherwise, your problem comes from mysql server settings. Check your mysql configuration file for bind-address, and remove them to make mysqld accept clients from any IP address.
The 3306 port on the 129.169.66.149 server is closed you'll have to open this port
Use this reference as a guide http://www.cyberciti.biz/faq/linux-unix-open-ports/