Unable to connect from local mysql server to AWS RDS db instance - mysql

I'm trying to import my .sql dump from local machine to AWS RDS db instance using the command:
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump --host=localhost
--user=root --password=admin e_learning_system | mysql
--host=mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com
--user=root --password=adminadmin e_learning_system
but it is throwing this error:
ERROR 2003 (HY000): Can't connect to MySQL server on
'mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com' (10060)
mysqldump: Got errno 22 on write
How do I correct this?

In case there is anyone who is still looking for a solution like I was, I managed to get it done by setting the security group in my RDS instance. Just go to that security group, you will find the click in "Security and Network" section. After you are on that security group page, edit the inbound rule, change the source to 0.0.0.0/0 (meaning accept from all) temporarily, and then import your db dump. That should work. But keep in mind you might want to revert it back this setting on production.

Yes, Amazon Beanstalk application and RDS security groups must be same for connecting application to database instance..
Right click on database instance and add a new security group using by beanstalk application..

error 2003 means no connection to mysql server. Check if you allowed the machine from where you connect to RDS in the RDS security group.

I prefer using MySQL workbench. It's much more easier & user friendly than the command line way.
It provides a simple GUI.
MySQL workbench or SQL Yog.
These are the steps that I did.
1) Install MySQL Workbench.
2) In AWS console, there must be a security group for your RDS instance. Add an inbound rule to that group for allowing connections from your machine. It's simple. Add your IP-address.
3) Open MySQL workbench, Add a new connection.
4) Give the connection a name you prefer.
5) Choose connection method- Standard TCP/IP
6) Enter your RDS endpoint in the field of Hostname (mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com).
7) Port:3306
8) Username: master username (the one which which you created during the creation of your RDS instance) (root)
9)Password: master password (admin admin)
10) Click Test Connection to check your connection.
11) If connection is successful, click OK.
12) Open the connection.
13) you will see your database 'e_learning_system' there.
14) Now you can export your mysqldump file to this database. Go to-> Server. Click Data Import.
15) You can check whether the data has been migrated by simply opening a blank SQL file & typing in basic SQL commands like use database, select * from table;

I was getting the same error and I solved it by adding mysql.exe... to the firewall of the machine I was connecting to.

Related

ERROR 2003 (HY000): Can't connect to MySQL server on AWS RDS

I created an external user with '%' hostname to allow remote access. I get the following error while connecting the local MySQL to remote AWS RDS:
ERROR 2003 (HY000): Can't connect to MySQL server on 'instance.cvxqy8tbi2bk.us-east-1.rds.amazonaws.com' (110).
I tried commenting the #bind-address = localhost but no solution.
Any pointers for this?
Anyone encountering this issue today should check out this YouTube video at around 6:05:
AWS RDS MySQL Database Setup | Step by Step Tutorial.
In a nutshell, you have to create a new inbound security rule to allow an external connection.
I had the same problem.
this solution: When you create database
in the Virtual private cloud (VPC), please choose "Create new VPC"
in the VPC security group, please choose "create new", don't choose "choose existing"
You should diagnose connection to ANY Mysql/Mariadb/RDS connection before changing any server parameter.
Always use this to check connection.
mysql -u username -p -h your_rds_instance_name
If connection fail, then check network connection(can you ping the instance name from your local system? ), i.e. firewall access, RDS Subnet rules, security groups rules. If the topics too advance for your, then follow the usual quickstart guidelines and tutorial.
"I tried commenting the #bind-address = localhost but no solution. "
No you cannot just comment it out.
If you want to allow remote connections to the MySQL database then you need to bind to your network adapter and not localhost / the loopback adapter.
So you need to get your server IP then:
bind-address = the.srv.ip.is
This is a better question for Server Fault ;)
I faced the same issue, turns out that I had made the database private to the VPC, meaning only instances in the vpc would be allowed to access the databse,
so either make the DB public or try to access the database using an instance in your VPC.
change settings to Publicly accessible. by clicking Modify option

Cannot connect to Azure MySQL service with MySQL Workbench

I'm using MySQL Workbench on a 64bit/Win 8.1 machine to trying to connect to an Azure MySQL service, but everytime I get the following error:
Lost connection to MySQL server at 'reading authorization packet', system error:0
I followed many tutorial found ever the internet, and I also tried to disable temporarely the firewall: most of them says that the only needed parameters are:
hostname (the one given in Azure portal/MyDB/Properties)
username (the one given in Azure portal/MyDB/Properties)
(optional) password (to store in vault)
I tried also using different connection methods (Standard TCP/IP and Local socket/pipe, as suggested here) but nothing.
Can help?
I was not able to recreate your issue. Here are the steps that I tried with a MySQL database created thru the Azure portal.
Open MySql Workbench.
Setup new connection with the following settings.
Hostname: HOSTNAME
Port: PORT
Username: USERNAME
Pasword: PASSWORD
Database: DATABASE NAME
Test Connection > Succeeded.
The settings above came from portal.azure.com > MyDatabase > All settings.
One suggestion is to contact ClearDB support. You can login to ClearDB from your database's Azure dashboard by clicking on Manage Database. From there you can go to Support and log a support incident.
I was also struggling with a similar issue, as I was not able to connect my MySQL workbench with Azure VM that's running MySQL.
I've contacted the Azure support to help me out after trying it for 3-4 hrs.
They suggested me to go into network security group of that VM, and add 3306 or whatever port that your MySQL is running on our Azure to the inbound and outbound list and add the exception as All.
It helped me to connect MySQL workbench with Azure VM with MySQL on it.

Connection failed in using mysqlconnector ODBC to connect from sql to access

I am trying to connect mysql database in phpmyadmin to the access file. I am using mysqlconnector ODBC for that. Tutorial I am following is this
The problem is that when I give the credentials to connect to database, it gives me error as shown in this snapshot
I have tried hard to search on internet but failed. What mistake I am doing. I am putting the ftp information of the server there. Is there any database credentials i need to put?
You can't use the FTP credentials to connect the MySQL database. You have to use the database credentials. Make sure you have done followings before connecting.
Make sure MySQL server is up and running on the HOST IP and PORT.
Your MySQL server can accept connections from your IP or use % for
all IPS
Make sure you have a valid USER account
EDIT
Or tell us where(local server, internet, IP) the MySQL database is installed. The port number the server is listening on. How you access MySQL server normally.

Unable to connect to MYSQL on a remote computer

I am working on windows and having a remote desktop connection of another machine. I am trying to connect to the mysql running on the remote machine through my MySql workbench, installed on my machine.
When I specify the details to connect to mysql i.e.
IP- a.b.c.d
port-3306
username=root
password=
But everytime it shows me an error saying-
Your connection attempt to connect to user='root'failed from your host to server at a.b.c.d:3306
Is it possible that I can connect to mysql on a different machine?
Certainly that is possible, mysql is a network transparent service. However obviously the normal access authorization rules apply.
do you have network access to the mysql port, this might be blocked by a firewall. You can check that by using telnet ip-address-of-server 3306. Does the server answer or do you get a timeout or are blocked? (the answer would look cryptic, soomething like 5.5.33-MariaDB[*[n7p~g!�iXccI$r9``Y{$mysql_native_password or similar )
the mysql server can be configured to not listen to remote connections. This can add security to the setup, but would obviously block any remote connection attempts. You will have to check the configuration files of mysql for that.
mysql itself implements an authorization level. So check if that 'root' user actually is allowed to connect from the outside. Those authorizations are stored in the internal "mysql" database.
Also it is not clear from the question what your network topology is: is the mysql server running on that system you have a "remote connection" to? Is the mysql-workbench running on that remote system or on your local system? This might affect the ip address you have to use inside the workbench.

Cannot connect to MySQL Server database at localhost:3306

When I first set up MySQL Server in Netbeans everything worked well. Now one day I think I accidentally clicked something or my computer lost battery life when I was connected to MySQL Server, and after these event(s) I have not been able to connect to MySQL Server. I do not know for sure if either of the above events would have any effect on connecting to a MySQL Server database.
Anyway since these events I have found that I cannot "start" or "connect" to a MySQL Server databse. I am doing this all through Netbeans IDE.
Here is a picture of how I try to connect to my databaseL:
This is what the error message says after I click connect:
Unable to connect. Cannot establish a connection to jdbc:mysql://localhost:3306/twitterdata using com.mysql.jdbc.Driver(Unknown database 'twitterdata'). The name of the database I am trying to connect to is twitterdata
How can I get reconnected to the MySQL Server database "twitterdata"?
I am not familiar with MySQL, databases, servers and I have no idea how to get reconnected. If there is any other helpful information that I should provide let me know.
What MySQL tools can I run to find my problem?
Why would the error message tell me that the database is unknown?
If I got to C:\ProgramData\MySQL\MySQL Server 5.5\data. There is a folder named twitterdata.
Here are the contents of that directory:
Please let me know if you need more information or if you have other suggestions that would help!
Thanks for all the help!
If you are using windows system and facing the error 'unable to connect localhost 3306' at the connection time. First you have to need start MySQL services in 2 steps:
Press "Windows key + R" write "services.msc"
And run as admin start MySQL service.
There can be three issues:
1) Either your server isn't even running. Open your command prompt and enter mysql
2)Let's say it is , can you check if it's connecting on the correct port.
Like in the url, you are using 3306,
Try following this post:
How do I find out my MySQL URL, host, port and username?
3) Can you check what if there are any credentials to the database you are connecting?
https://netbeans.org/kb/docs/ide/install-and-configure-mysql-server.html