Can not connect to AWS RDS mysql from SQLWORKBENCH - mysql

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.

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 an MySQL server using MySQL Workbench over SSH

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.

Can't connect to MySQL with DataGrip via unix socket

it's my first time using DataGrip trying to connect to MySQL in a Ubuntu 18.04 server.
I've added a new user to MySQL. When I try to connect to MySQL using the command MySQL -u user -p works.
But on DataGrip, I've created an ssh tunnel and it's making the connection without any problems.
But when trying to connect to MySQL it gives this error The specified database user/password combination is rejected: [28000][1698] Access denied for user 'user'#'localhost'.
I am sure that the password is correct and in the log file it is showing that it's making the ssh connection, but it gives access denied when connecting to MySQL. If someone could help me, I appreciate it.
To connect to MySQL server using unix sockets follow an article in DataGrip documentation.
Connection via sockets available in DataGrip since version 2021.1.

port fowarding for mysql server ubuntu remote connection

I have a ubuntu 16.04 on which I run 3 servers from virtualbox (a webserver, a home file server and a mysql server).
In this mysql server I naturally have an internal ip (192.168....) and an external one.
However when I try to connect remotely to this mysql server from mysql shell, workbench or .NET connector (eg. mysql -u root -p -h 172.241.442.12) using the external IP of this virtual machine I always get ERROR: Not connected.
My question is whether to connect I have to enable port forwarding in my router (3306), just as I would do enabling 80/8080 in a webserver to make it accessible from the internet.
I never did it before and haven't find any clear tutorial either. My main purpose is to connect to this db in a vb.net application.
Thanks!
Yes, if you intend to access it in this manner you will need to forward a port. You will also need to grant access to MySQL for a user that is allowed remote access.
GRANT ALL ON somedb.* TO `user`#`123.123.123.123` IDENTIFIED BY 'somePassword'
The IP address can be a hostname, or % to match everything.
That said, unless you really need a permanant external connection to MySQL you should not expose it like this, the better option would be to tunnel the port through SSH.
ssh -N user#dbserver -L12345:localhost:3306 &
mysql -u root -h localhost -P 12345

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.