Laravel 4.2.22 repo cant connect to AWS DB - mysql

I've set up a DB on AWS RDS and when testing our current API against it, I get "Can't connect to MYSQL server...". I can connect to the DB via MYSQL workbench and shell. The API is Laravel 4.2.22 (I know it's old) hosted on an on-prem server via Apache. I duplicated the API, hosting it locally via 'php artisan serve' and was successfully able to hit the DB from that test repo. I need the repo to work on it's current version. I'm not quite sure what to test or where to look. Any direction would be much appreciated.
Error log:
stage.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on '...rds.amazonaws.com' (13)' in /var/www/sites/stage/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47
Stack trace:
#0 /var/www/sites/stage/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(47): PDO->__construct('mysql:host=hard...', 'user', 'pass', Array)

Related

How do I connect to my RDS MySQL instance programmatically?

Problem
I launched a MySQL RDS instance and was able to successfully connect to it using MySQL Workbench. However, I am still not able to connect to it from my local workstation using the following URI:
'mysql+pymysql://user:password#db_identifier.XXXXXXXXXX.us-east-1.rds.amazonaws.com:3306/db_name'
or the same URI without the port:
'mysql+pymysql://user:password#db_identifier.XXXXXXXXXX.us-east-1.rds.amazonaws.com/db_name'
The error that I receive when I specify this as my database URI and execute a db.create_all() command is:
sqlalchemy.exc.OperationalError:
(pymysql.err.OperationalError)
(2003, "Can't connect to MySQL server on 'db_identifier.XXXXXXXXXX.us-east-1.rds.amazonaws.com'
([WinError 10060] A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection failed because
connected host has failed to respond)")
Question
What can I do to connect using pymysql? And why would it connect with MySQL Workbench and not through this URI?
Context
I am following the tutorial here. This uses SQLAlchemy to execute the SQL statements in Python.
The RDS instance (and its associated subnet/VPC) have the following:
a security group open on port 3306
NACL rules that allow incoming and outgoing traffic
Public Accessibility set to "Yes"
Check my answer on this post, it could be something about the "Public accesibility" option in your rds "Connectivity and Security" section as described here;
https://stackoverflow.com/a/63514997/2934184

AWS EB Operational Error "Lost Connection to MySQL Server"

I'm new to AWS services and I'm trying to deploy a simple Django app to Elastic Beanstalk. I found this documentation that says "to decouple your database instance from your environment, you can run a database instance in Amazon RDS and configure your application to connect to it on launch."
I followed this documentation to set up a PostgreSQL DB and uploaded my source code. When I deployed the project, the health check passed. So I tried to follow the URL to my site, and it just tries to load forever.
I checked the error logs (/var/log/httpd/error_log) and found OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 0").
Why is it trying to connect to a MySQL when I want to use the PostgreSQL database?

Spring Boot Connection to MySQL on remote SSH server

I am trying to connect to MySQL server at remote machine using spring-boot application.properties but it is failing with error o.s.b.a.orm.jpa.DatabaseLookup: Unable to determine jdbc url from datasource.
My database URL is in the correct format. Remote Server requires ssh connection and I have connected it successfully using MySQL Workbench. For connection via spring-boot app, I checked solutions and implemented JSCH solution as explained in post:
Spring Boot SSH Mysql? but still no success.
Remote Server SSH port is 202 instead of default 22. Any help on how to connect DB?
Please refer information mention here -
here
or
stackoverflow page

Cannot connect to Remote SQL DB with Dreamfactory

I am attempting to connect to a remote MySQL database using DreamFactory app.
This is what I am doing:
http://i.imgur.com/S9WHZ5i.png
And this is the error I see in the Dreamfactory app log:
[2014-06-14 09:47:53] app.ERROR: REST Exception #500 > Failed to
launch service "myservice": CDbConnection failed to open the DB
connection.
{"host":"myaddress","request_uri":"/rest/myapp","source_ip":"...","sapi_name":"apache2handler"}
[] [2014-06-14 09:47:53] app.ERROR: SQLSTATE[HY000] [2003] Can't
connect to MySQL server on '...' (111) [] []
I checked on my MySQL machine for any access attempts and I see none.
I think I configured something wrong in the Dreamfactory Admin screens.
Please help!
Many thanks!
User has answered his own question. Had to enable incoming connections within his Amazon EC2 instance. Just a heads up to others having the same issue out there.
Thanks,
Mark

Will my PHP application work with Heroku's ClearDB MySql resource?

I am new to both php and Heroku and I have run into a bit of a problem. Currently my application is running fine on my xxamp testing server with mysql however when I try to host it on Heroku, there is no connection to the MySql server.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (111)' in /app/www/pdo_testdb_connect.php:6 Stack trace: #0 /app/www/pdo_testdb_connect.php(6): PDO->__construct('mysql:host=127....', 'd2398h23d9d82j3', '8dj1292d3') #1 /app/www/all.php(6): testdb_connect() #2 {main} thrown in /app/www/pdo_testdb_connect.php on line 6
Does ClearDB not work with PHP? Any suggestions would be much appreciated as I've sort of hit a brick wall.
Here is the php integration of Cleardb with Heroku:
define ('DB_USER','xxxxxxxxxxxxxxxx');
define ('DB_PASSWORD','yyyyyyyyyyyyyy');
define ('DB_HOST','us-cdbr-east.cleardb.com');
define ('DB_NAME','heroku_zzzzzzzzzzzzzzzzzz');
Take the params by going in Git and typing heroku config.
You will see a CLEARDB_DATABASE_URL
Here is how to decode it:
mysql://xxxxxxxxxxxxxx:yyyyyyyy#us-mm-auto-dca-01.cleardb.com/heroku_zzzzzzzzzzzzzzz
Interestingly enough, in the official documentation they provide only a Ruby example but nothing about php..
http://devcenter.heroku.com/articles/cleardb
heroku config | grep CLEARDB_DATABASE_URL