Configuring Play Application for MYSQL Database in Amazon EC2 - mysql

I am trying to use a mysql database in my play 1.2.4 application hosted in Amazon EC2 .
For that, I configured application.conf file with the following snippet in my local environment.
db=mysql:root:password#databasename
and this works fine.
Same mysql server have been configured in my EC2 instance with same Database created .
What should be the configuration to use that DB in EC2 . After several trial and error methods , I am not able to make my Play application talk with the database .
Thanks in advance .

I would diagnose this problem with the following tests:
Can you reach your mysql server from the same machine you are running your application from?
When trying this, make sure that you use the same user and password as in your application.
Have a look at the mysql users table and check if the user is allowed to connect.
Is the mysql daemon bound to localhost or do you have to use the IP or external DNS name of the machine?
Try checking your firewall rules that the port for mysql is open from your application machine
Also check the EC2 Security group that the mysql port is open from your application machine.

Related

How to see MongoDB hosted via AWS DocumentDB when using mongosqld on AWS EC2

Goal
I am trying to use MongoDB's BI Connector for Tableau, aka mongosqld. I have version 2.10, so here are the docs.
My long-term goal is to host mongosqld as a service on an AWS EC2 instance, and host MongoDB on AWS DocumentDB.
Background
A successful set of baby steps was:
Host MongoDB in a Docker container on my local machine via mongo image
Manually run mongosqld on my local machine, without a schema
Connect to it via mysql from my local machine
This works fine, I could see all of the databases via show databases;
My next set of steps was:
Host MongoDB in AWS DocumentDB
Host mongosqld on my EC2 instance at address 0.0.0.0:3307, without a schema
Enable TCP comms on port 3307 and 27017
Connect to it via mysql from my local machine
When I use mysql shell's show databases; command, I cannot see my databases, only information_schema and mysql.
Question
Given all of this information, does anyone here know what might have gone wrong? I am currently at a loss for what to try next.

How to run SQL Profile on AWS Aurora or Mysql

What tool can I use to run sql profile against a AWS Aurora or AWS Mysql database? Seems like a simple task that I have done many times against local mysql sql db or ms sql server, but for the life of me I cannot get to work. Is this something that can be done? I have been trying to use Neor Profile without success. However, I'm able to use Neor Profile successfully on my local mysql db.
Because Neor Profile basically serves as a proxy, you have to use port 4040 in your application and then Neor connects to AWS via port 3306. I can successfully get Neor Profile 'profiling' against the AWS db but when I run my local application or mysql workbench, via port 4040, it doesn't connect, with a general connection error.
My question, which I can't find by searching the Internet or help files is...Can you perform a sql profile against a AWS Aurora or AWS Mysql database?

How to browse data in MySQL database on Amazon EC2?

I deployed my Rails app to Amazon EC2 server (Ubuntu), but I am thinking how to connect to MySQL database from terminal (SSL) and manually check data in database.
How to do that? I see in the database.yml file some credentials, but don't know how to connect/log in into MySQL on EC2 instance.
Thanks
There's no special magic involved here. An EC2 server is just... a server. This is not hosting like heroku or godaddy where your database is going to be hosted on a different db server.
Unless you explicitly setup a separate db server (which I don't think you did), you've got an entire virtual machine running Ubuntu, and the db server is most likely running on the same machine.
So you can ssh into the machine and just run the standard mysql client. Docs here: http://dev.mysql.com/doc/refman/5.6/en/mysql.html.
If you want to use some gui software such as sequel pro mentioned in one of the comments, you'll need to open up the ports in the aws console. Amazon closes all the ports by default. Do this to open up the port:
Open up the AWS control panel
Go to 'Security Groups'
Select the security group in the panel (you probably only have one).
Click the 'Inbound' tab.
Select Mysql from the dropdown list
Save the rule
This will open up port 3306 and enable you to use an external tool to see the server.
If you just want to call some sql to the database just to verify small amount of data, you can try doing these:
sql_statement = 'SELECT * FROM users'
ActiveRecord::Base.connection.execute(sql_statement).to_a

Connect to MySQL local database via PHPMyAdmin

I have two servers running on Ubuntu. Server 1 only has MySQL installed and acts as an database. Server 2 is a Apache web server. The database is internal and so as the Apache server and they can ping each other but the database server is not accessible via the internet. I can telnet into the database server from the Apache but I can not connect to the database via PHPMyAdmin.
So the question is how I can configure this to work. I also don't want to allow access to the whole server (databases), access only via user name and password specified.
Thanks!
Define your user as user#[hostip-of-Php-myadmin-server] and you should be set?
It was a BIND issue, it's all fixed now.

Create datasource for mysql to different machine in glassfish

I'm using glassfish(v2.11) as my application server and I have another machine for mysql database server. Currently I want to separate the app server and db server, so I create a jdbc datasource to point to mysql server, but it doesn't works as expect, by the way, when I create datasource to point to local machine (glassfish app server and mysql db server in single machine), and It works well.
Is there any configuration I need to care of when pointing datasource to different machine which I use to host my database (MySQL 5.1)?
Besides granting the mysql user you'll connect as the proper rights, specifying the host in the JDBC url, and making sure there's no firewall stopping you (default mysql uses port 3306), there should be no difference.
WOW ...restart glashfish app server and it works .. :)