MySQL: Unable to connect using TCP/IP over SSH - mysql

We have an EC2 and RDS instance on Amazon Web Services. I usually first connect to the server using Putty and then access the database through a tunnel from my localhost.
I am now trying to directly connect to the database using TCP/IP over SSH, but get the following error. I am able to connect other applications such as FileZilla directly without creating any tunnels, but not able to connect MySQL. Please advise. There is no entry in known_hosts file.
Error:
[Window Title]
MySQL Workbench
[Main Instruction]
Failed to Connect to MySQL at database.aws-server.rds.amazonaws.com:3306 through SSH tunnel at username#100.100.100.100:22 with user username
[Content]
Cannot open SSH Tunnel: Error connecting SSH tunnel: The host 100.100.100.100 fingerprints mismatch.
Expected key: hjd83iuwe98jdoiw8euoqeuo83eqe308
Server sent: 8ru84ru8ur984u8djc0938y4jddj398e
Please verify if it's correct.
To continue, delete entries for the host from the C:\Users\<USER>\AppData\Roaming\MySQL\Workbench\ssh\known_hosts file.
[OK]

I am connected to my rds database using the following script-
ssh -L 3406:database.aws-server.rds.amazonaws.com:3306 -i username#100.100.100.100
this command will create a tunnel on your local machine port 3406 of the mysql's default port 3306.
after that you can connect at 3406 port in your application

ssh-keygen -f "C:\Users<USER>\AppData\Roaming\MySQL\Workbench\ssh\known_hosts" -R "database.aws-server.rds.amazonaws.com"

Related

Error when using the command line terminal to connect to the Azure MySQL server

I'm using the command line prompt on my Windows computer to connect to my Azure MySQL server.
hostname=flashguard.mysql.database.azure.com
username=damiboyflashguard123
port=3306
I entered following on my cmd
mysql -h flashguard.mysql.database.azure.com -P 3306 -u damiboyflashguard123 -p
and entered the password. Then I'm getting following error,
ERROR 2003 (HY000): Can't connect to MySQL server on
'flashguard.mysql.database.azure.com:3306' (10060)
By the way I checked my firewall settings, and it shows firewall is approving on 3306 port requests as follows.
I installed MySQL client in my local machine and tried connecting to Azure mySQL client via command line terminal and was connected successfully:-
ERROR 2003 (HY000): Can’t connect to MySQL server on
‘flashguard.mysql.database.azure.com:3306’ (10060)
Make sure your MySQL server name with username and password does not have any syntax missing or spelling errors. Add your local machine’s IP to the allowed list of Azure MySQL servers like below:-
Make sure your MySQL server is in a ready state and also try to connect to your MySQL server from your Azure Portal to check the connectivity.
Verify your connecting string from Azure Portal like below:-
I ran the above command in my local machine’s command line terminal and I got connected to the azure MySQL server successfully like below:-
mysql -h server-name.mysql.database.azure.com -u xxxxconuser -p xxxxxxxxxn#123
Output:-
When I removed the Client IP from the azure MySQL Networking tab, I got the same error code as yours, refer below:-
Error:-
Verify if you’re connected to any VPN that is restricting you from connecting to the MySQL server on Azure.

Connecting Jetbrains DataGrip to a remote database via SSH

I have an AWS Lightsail instance running the Bitnami configuration for Ubuntu 16.04.5 LTS and PHP7.
I can connect the the MySQL database using phpMyAdmin on the server via an SSH Tunnel. But when I try to configure DataGrip for SSH access to the database I receive the error message "Host '127.0.0.1' is not allowed to connect to this MySQL server".
When I remove "localhost" from the host field of the General tab then I receive the error "ExecutionException: SSH: Unable to find host/port in URL".
The following test and response appears to show a successful connection to the port:
cat < /dev/tcp/###.###.###.###/22
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
I'm using keypair auth. Both the user name and the Private key file are the same used for the ssh tunnel when running phpMyAdmin.
Not sure what to try next. Any help appreciated.

cant connect to local mysql server through socket when trying to connect to VM from host

I'm working on cloud computing. My network setting for VM is .. Adapter 1:host only adapter Adapter 2: NAT.im trying to connect from host to MySQL server that is in my virtual machine.i had to change the bind address in /etc/mysql/my.cnf to IP of host .now I'm not able to connect to MySQL
sudo mysql -u root -p
throws error
"cant connect to local MySQL server through socket"
the error.log tells that TCP/IP issue. what should i do?

Cannot Connect to Database Server MySQL Workbench Tunnel Error

Every time I try to connect to my mySQL on mysql workbench, it gives me this error message saying:
Your connection attempted failed for user 'root' from your host to server at http:x.x.x.x:3306: Cannot open SSH Tunnel:Error connecting SSH tunnel:Error Connecting to SSH server Error 11004 get addrinfo failed
I think you could get solution here: http://quintagroup.com/services/support/tutorials/mysql-linux
or follow this steps:
Open putty and accept the certificate of the server
hostname should be localhost ( in order to use local socket and not http conection)
local port should be something like 33010 not 3306
local port is the conection back port used by the plink and has nothing to do with mysql ports

MySQL remote access via SSH Tunnel error

I've created an SSH tunnel on my local machine to reach an access to the mysql server on my remote machine. Everything is fine, tunnel is working if I get this error, but why this error occurs?
Here is the error message:
2013 - Lost connection to MySQL server at 'reading initial communication packet', system error: 0
It happends only, when I want to connect via Navicat (SSH Tunnel) from my local to the remote machine, on the remote machine mysql works without such errors.
Have you guys any solutions for that?
This error occurs when the configuration of the bind-adress option is wrong. Your MySQL server at least should listen on the localhost - 127.0.0.1
Login to your local Linux machine then run this command:
ssh -L 3307:localhost:3306 -N user#remote.server.com
Use the mysql database from remote server:
mysql -u root -p --port 3307 -h 127.0.0.1
Make sure the local mysql does not use the same port in Linux environment.