# Having trouble connecting existing mySQL database to Dreamfactory

**URL:** <https://community.dreamfactory.com/t/having-trouble-connecting-existing-mysql-database-to-dreamfactory/2231>\
**Category:** Connecting to SQL\
**Created:** [February 18, 2016, 11:05pm UTC](https://community.dreamfactory.com/t/having-trouble-connecting-existing-mysql-database-to-dreamfactory/2231 "2016-02-18T23:05:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farhad33](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/farhad33/32/611_2.png) [@Farhad33](https://community.dreamfactory.com/u/Farhad33)\
**Post date:** [February 18, 2016, 11:05pm UTC](https://community.dreamfactory.com/t/having-trouble-connecting-existing-mysql-database-to-dreamfactory/2231/1 "2016-02-18T23:05:24Z")

</div>

I have tried connecting my existing database (mySQL) to dreamfactory, but I am having trouble. I’ve tried connecting it through the Services tab, but I am unable to connect it to it. I’ve provided the DSN using my hosts’ name and port…I’m not sure what the problem could be, or what step I am missing. I have not found any step-by-step guidance for connecting an existing db.

---

<div class="post-metadata">

**Author:** ![mlucas](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mlucas](https://community.dreamfactory.com/u/mlucas)\
**Post date:** [February 18, 2016, 11:37pm UTC](https://community.dreamfactory.com/t/having-trouble-connecting-existing-mysql-database-to-dreamfactory/2231/2 "2016-02-18T23:37:32Z")

</div>

First, make sure that the bolded words here are set for your service (under the Config tab):

> Driver: **MySQL**  
> Connection String (DSN): mysql:host= **localhost** ;port= **3306** ;dbname= **db\_name** ;charset=utf8  
> **Username**  
> **Password**

Second step is double-checking that it corresponds to the settings in MySQL. Connect to mysql on the command line and check:

- That the database exists: **show databases;** should have an entry for **db\_name** from above (something like farhads\_app, not dreamfactory).
- That the user exists: **select user, host from mysql.user;** should have an entry for **Username | localhost** if that’s what you set above.
- The user permissions: **SHOW GRANTS FOR ‘Username’@‘localhost’;** and make sure that there’s an entry for _GRANT ALL PRIVILEGES on `db_name`. TO ‘Username’@‘localhost’_\*.
