Not sure if what I am attempting to do is possible or not. I just launched my very first EC2 instance running Ubuntu 12.04 and successfully installed Laravel 4. I have the database working just fine on the EC2 instance and I am able to connect to it with MySQL Workbench on my local machine using a .pem SSH key.
I will be using EC2 to handle certain aspects of a product that I am developing to ensure improved reliability - client side users will be interacting with this primarily through CURL. I want to be able to have my non-EC2 website, also running Laravel 4, use the MySQL database that I set up on my EC2 instance.
I tried changing my app/config/database.php file to include the EC2 instance IP address and MySQL credentials, when Laravel attempts to connect it returns a timeout error.
I modified my.cfn and commented out bind-address = 127.0.0.1, I do not seem to have the skip-network that I have seen mentioned. Still no joy.
Any suggestions?
In side MySQL (PhpMyAdmin if you installed it) -> Users overview -> Edit your user with Host is
%
That is mean, you can connect to MySQL in anywhere with command
mysql_connect($IpOfYourHost, $UserAbove, $Password)
Maybe this helps you. :)
Resolved
I changed bind-address to 0.0.0.0, created a new MySQL user - 'user'#'%', and had my host whitelist the IP. Done!
Related
I have set Ec2 Linux server with only PHP is installed in it not mysql.
I have separately configured RDS
Installed workbench and logged in using endpoint of RDS and username and password
In workbench DB connection done. I imported my local DB to RDS
Now In my Ec2 I onlu have PHP not mysql as my db is in RDS
In my ec2 php is running In check it with simple hello world echo file.
But mysqli_connect script is giving connection time out error. I used the same credentials as I used to connect to workbench. And I am also using the right script of mysqli_connect.
My doubt is Is it because of I did not installed mysql in my ec2 linux server. But Why I need mysql in ec2 if I have successfully setup DB in RDS.
First thing is that to install mysql-client and try that again. There can be several issues if it doesn't work even after trying to connect with mysql-client and consider those as well.
The state of the RDS instance should be 'available'. Otherwise it won't connect to any.
Check whether your EC2 instance IAM role has the permission which needs to access RDS instance. If your IAM role doesn't have permission then it won't get permission to connect and it will timeout after a while.
*It's better if you can post some code here.
I'm having a bit of an issue with connecting to my Amamzon RDS (Mysql) instance through a fresh Lumen installation on an Amazon EC2 instance.
The Lumen installation uses the PDO class.
The problem:
I can't connect to my RDS, I'm simply getting a timeout when trying:
SQLSTATE[HY000] [2002] Connection timed out
What have i tried?
I've tried connecting directly to the ip of my rds instance. Same result.
When debugging my connection, I get a connection string like mysql:host=x.x.x.x;port=3306;dbname=(...) - ip and db are correct. Username and password are also correct when debugging the connection.
Connecting from another server, that is outside Amazon AWS. Also using PDO = negative result
Checking that the RDS is set up to available from the outside = It is, I can connect from my own computer. Tested with two different machines.
Looking through various posts about rds and timeouts = no usable solutions
Connected directly to the ip of my RDS instance = negative result
When developing on my local machine, I'm not having any problems connecting to the same rds.
Anything else you should know?
When connecting from my computers (using Sequel Pro), i can connect - I've tried from two computers, both with positive result. This is indifferent if i use the domain/endpoint of the rds instance or connect directly to the ip.
By my own logic, I should be ablet to connect from any EC2 instance, since I can connect from my own computer.
Any help would be appriciated.
Did you actually give the right permission inbound to RDS from that EC2 Instance?
You need to modify your security group to give access.
I have just installed MySQL on to my AWS EC2 server, I have also imported my existing SQL file so that my new MySQL db is now populated. I would like to be able to browse my database somehow.
In the past I used phpmyadmin and it was great, should I install phpmyadmin and then access it through my browser somehow? or am I looking down the wrong road.
Cheers
No reason you cant install phpmyadmin on your new EC2 server. Just remember to open up the necessary ports through amazons security group, and if you dont want the whole world to be able to access it, you can restrict the ports to only IP addresses you use.
AWS SECURITY GROUPS
I am currently programming a launcher in Visual Studio that gets the version history from a MySQL server. I have run into an issue where I cannot connect to the database if I use a public login for the database. If I use the root login I can connect on my local machine but no other. This is what I am using with subins to protect my data:
"server='serverip';user='severusername';password='serverpassword';database'databasename'"
If I use the root password, it will connect on my local computer. If I use my godaddy hosting database, it will also work on any computer. The MySQL server I am connecting to is on my local computer and running WAMP. Does anyone know a way to get it to work? My user has full permissions. This is programmed in Visual Studio using Visual Basic.
It appears that you have a typo:
database'databasename'
Should that not be:
database='databasename'
Also, it could be that godaddy does not allow remote connections for MySQL so when you try to connect from your local WAMP installation to their remote MySQL server the connection is denied. This is more than likely the case as the bandwidth cost for this can become quite huge very quickly. You should however be able to run things in the shared hosting environment using localhost as the server/hostname.
I fixed it by adding 2 cases of my user. One with a host of localhost and another with a host of 127.0.0.1
I have developed a web application that uses PHP and MySQL and has all been running fine from a single development server. I now want to separate things a bit and place an app server within Amazons cloud that will receive and process uploaded files. The database is going to remain on the dedicated server but will need to be accessed by the EC2 instance.
Heres what I have tried so far...
In phpMyAdmin I added a new user to the privileges table. I gave it the elastic IP address from AWS as the host name, a new password and granted privileges to INSERT, SELECT and UPDATE.
In the PHP scripts on my EC2 based app server I included this username, password and the domain name of the location of the mysql server (example.domain.net) when connecting with mysql_connect
I have a simple test page that tries to SELECT and echo some results from the database but get the following error -
Could not connect to MySQL: Can't connect to MySQL server on 'example.domain.net' (4)
What could this mean, what have I missed, are there any other issues such as trying to do this from within EC2 that will cause other problems?
cheers all
Turns out the only other thing I needed to do was to open port 3306 on the database server to allow access. Did this by going to Control Panel -> Windows Firewall -> Exceptions -> Add Port ["SQL", 3306]
Now it works great!