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

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.

Related

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.

Cannot connect to AWS SQL database - ERROR 2003 (HY000): Can't connect to MySQL server on '<endpoint>' (111)

I have a remote SQL database (RDS) on Amazon Web Services which I am attempting to connect to via the Linux terminal.
Having run the following command, substituting each value:
sudo mysql -u <username> -h <endpoiont> -P <port> -p
and then entered my password, I get the following error message:
ERROR 2003 (HY000): Can't connect to MySQL server on '<endpoint>' (111)
This used to work up to a few weeks ago and I have not changed any of the AWS permissions and security settings since. I also changed the password since this error but this did not solve the problem.
My application itself can connect to the DB, only I cannot connect via the Linux terminal.
Some solutions that I have read related to making changes to local files but this SQL database is hosted on AWS, not on my local machine.
Any suggested solutions are welcome.

MySQL Workbench import/export: ERROR 2003 (HY000): Can't Connect to MySQL server on 'localhost' (110)

Using:
Ubuntu 16.04 LTS.
MySQL 5.7.17
MySQL Workbench 6.3
In MySQL Workbench I can connect to my local instance, create a new database and edit this database.
But, if i try to import an sql file I am getting the following error:
ERROR 2003 (HY000): Can't Connect to MySQL server on 'localhost' (110)
It does not matter the size of the sql file - even a simple create table and one column with no data causes the same error.
But, If I use terminal:
mysql -u username -p database_name < file.sql
data imports fine, I can then use Workbench to edit the database no problem.
But, If I then try to export the database, I run into the same problem, but I can export via the terminal.
I am using the root user, with the correct password in each case.
Any pointers would be very gratefully received.. I am stumped!
thank you
You appear to be connecting to localhost so I would assume that mysqlworkbench is trying to lookup a domain socket in a wrong place.
Try to switch to a tcp/ip connection by explicitly setting 127.0.0.1 instead of localhost
https://dev.mysql.com/doc/refman/5.5/en/connecting.html#option_general_socket
For connections to localhost, MySQL programs attempt to connect to the
local server by using a Unix socket file. To ensure that the client
makes a TCP/IP connection to the local server, use --host or -h to
specify a host name value of 127.0.0.1, or the IP address or name of
the local server

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.

Mysql cannot connect AWS RDS on terminal

I have a AWS RDS instance running on the free tier, and am trying to use mysql command to connect it, just to play with it.
The command I used is
mysql -h XXX.XXX.us-west-2.rds.amazonaws.com -P 3306 -u username -p
but after a while it returns
ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XXX.us-west-2.rds.amazonaws.com' (60)
The instance I am running on AWS is MySQL, and I used the correct server address when connecting. Can anyone tell my why the connection does not get through?