Connect to an MySQL server using MySQL Workbench over SSH - mysql

I am successfully able to login to a VM over SSH and to the SQL server from the command line.
But when I try to add a connection on MySQL Workbench and using the same credentials, same host (hostname is an IPV4 address), it says
Failed to Connect to MySQL at <Ip address>:3306 through SSH tunnel at user#VM with user <username>.
Unable to Connect to localhost.
Do anyone have any idea on this issue
I have no mysql installed on my local machine.
Try connecting OVER ssh through commandline and connection was successful. See below
ssh user # <ipaddress of VM>
then
mysql -h <Mysqlhost> -u < user > -p < database > -A
But when I try to do the same via MYSQL workbench, it fails.

Make sure you fill all the details like shown in the image below.
The error message you have posted shows that MySQL Hostname and Username is not filled.

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.

Connect to remote db with ssh tunneling in DBeaver

I know this question was already asked before (like here), but still I could not find a solution and those posts are quite old.
So I am able to connect to the remote db with an ssh connection and then use the command line like this:
// Putty SSH Connection
host: ssh.strato.de
port: 22
username: xxxxxxx
password: xxxxxxx
// connect to mysql with terminal
mysql -h rdbms -u xxxxxxx -p xxxxxxxx
If I try the same with ssh-tunneling in DBeaver I get an connection error
The ssh-tunneling itself seems to work. If I use the same credentials as above and press "Test tunnel configuration" I get a success message.
I tried several other options for port and host (localhost, rdbms.strato.de, etc), which I found via mysql show variables; show processlist; show user();, but none of them worked.
The Strato Support told me that I can only connect to the db internally with phpmyadmin or remotely wiht putty and mysql, but since the last method is working, shouldn't ssh-tunneling also work?
Dbeaver - Database connection using SSH Tunnel
Open dbeaver
Click on "New Database Connection", in the following "main" window enter the MySQL server host relative to the SSH server, and MySQL running port, my setting is default (localhost, 3306)
specify MySQL user to connect with and user password.
In the "SSH" part, specify the SSH host, port, user also the authentication method used, like SSH private key
Test connection and use.
On shared hosting setups (e.g. IONOS) there might be a restriction when trying to connect to MySQL from external client
https://www.ionos.com/help/hosting/troubleshooting-mysql-databases/connection-and-access-problems-with-mysql-databases/

How do I connect to my database URL (retrieved from heroku) using mysql installed on my local xampp in windows

I have heroku app running using a Jaws Maria db as a add on, I want to access the database using xampp's mysql on windows 7 machine. I got my database url via
heroku config:get JAWSDB_MARIA_URL --app MYAPPNAME
which got me a string like
mysql://username:password#serveraddress:3306/dbname
i'm trying to access this database url via the command from my cmd
E:/xampp/mysql/bin/mysql -u username -h serveraddress.amazonaws.com -P 3306 -D dbname -p
accoring to the thread Access mysql remote database from command line
after providing the password im getting an error
Can't connect to MySQL server on 'serveraddress.amazonaws.com' (10060 "Unknown error")
Whereas if i try to connect to ths database from c9.io I can access it using the command
mysql -u username -h serveraddress.amazonaws.com:3306 -p
Can anyone help me so that I can access it from xampp's mysql in windows as well. Cant figure out what am I missing here

Pentaho JNDI ssh tunneling Data Integration MySQL

I am trying to access a database server using SSH tunneling, credentials are fine, as i have tested this on MYSQL GUI Client using SSH Tunneling option, i have also just tested this using command line and command line connection to server is also working perfectly using below commands on two command line terminals:
ssh root#192.168.1.1 -L 3307:localhost:3306
mysql -h localhost -P 3307 -u qstats -pPassw0rd stats
But when i try to connect to the database server using pentaho it gives error as
Access denied for user 'stats'#'localhost' (using password: YES)
I then used JNDI and gave the credentials there, but still it does not work, my JNDI settings are as follow:
Asterisk/type=javax.sql.DataSource
Asterisk/driver=com.mysql.jdbc.Driver
Asterisk/user=qstats
Asterisk/password=Passw0rd
Asterisk/url=jdbc:mysql://localhost:3307/stats
Please if someone can help?
You need to initiate the SSH connection separately using CMD to the database server and then try to connect using PDI, and connection will be successful. BUT JNDI still don't work, only direct connection works.

Can not connect to AWS RDS mysql from SQLWORKBENCH

I am new to AWS. I followed AWS quick start documentation and created my Web server and Database server. I can connect my Web server from my browser and ssh client. But i couldn't connect my MYSQl database from SQL workbench or MySQL yog.
I tried connecting it through command line from my web server its connecting. I thought its due to some user access problem and tried changing the user access by query and it says access denied for giving grant permissions. please suggest me the how to connect to AWS RDS from remote machine(any sql gui tool).
I'm not sure if it's proper way, but you can create ssh tunnel like that:
ssh -N -L 6033:RDSendpoint.rds.amazonaws.com:3306 -i /path/tokey/aws-key.pem ec2-user#EC2IPAddress
And then connect using mysql -h 127.0.0.1 --port=6033 -u yorrdsuser -p from local.