# How to connect to a mysql database hosted on EC2

**URL:** <https://forum.bubble.io/t/how-to-connect-to-a-mysql-database-hosted-on-ec2/203495>\
**Category:** APIs\
**Created:** [April 23, 2022, 5:33am UTC](https://forum.bubble.io/t/how-to-connect-to-a-mysql-database-hosted-on-ec2/203495 "2022-04-23T05:33:19Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![divyanshu](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@divyanshu](https://forum.bubble.io/u/divyanshu)\
**Post date:** [April 27, 2022, 8:33am UTC](https://forum.bubble.io/t/how-to-connect-to-a-mysql-database-hosted-on-ec2/203495/3 "2022-04-27T08:33:00Z")

</div>

Thank you Joeyg. I was able to figure out the connection strings. Thanks for your input.

If anyone else needs it, this is what I used.

mysql://:@\<ec2’s Public IPv4 DNS\>:3306/

Notes from bubble docs:  
If there are special characters in the password, they must be URL-encoded, for instance replacing `#` with `%23` . The rest of the encodings are listed [here](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding)

On top of this, I had to open an inbound rule in my security group, to allow all connections through. Much more has been written down here.

> [@SQL Database Connector Timeout](http://forum.bubble.io/t/sql-database-connector-timeout/27151/3):
>
> Alternative method, I even launched an Amazon RDS instance, to avoid the firewall issue completely, and THAT won’t connect either. What I’m thinking is Bubble doesn’t provide fixed ports for accounts, so there is so reliable way to keep a connection open. I can connect to the server with workbench, so I know it’s available, but Bubble always times out.

---

_[View the full topic](https://forum.bubble.io/t/how-to-connect-to-a-mysql-database-hosted-on-ec2/203495)._
