# Auth via External DB

**URL:** <https://community.dreamfactory.com/t/auth-via-external-db/1724>\
**Category:** App Configuration\
**Created:** [November 5, 2015, 7:17pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724 "2015-11-05T19:17:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammed\_Imran](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mohammed\_Imran](https://community.dreamfactory.com/u/Mohammed_Imran)\
**Post date:** [November 5, 2015, 7:17pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/1 "2015-11-05T19:17:22Z")

</div>

I am using DF 2.0 in Amazon instance. I have RDS which has mysql DB. How can i store users, roles and all DB operations in my external DB…

---

<div class="post-metadata">

**Author:** ![Jonathan\_Irwin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jonathan_irwin/32/461_2.png) [@Jonathan\_Irwin](https://community.dreamfactory.com/u/Jonathan_Irwin)\
**Post date:** [November 6, 2015, 2:09pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/2 "2015-11-06T14:09:23Z")

</div>

HI there, I think that I am having the same issue as Mohammed.

I am new to DreamFactory and there is something I don’t quite understand.

I already have a users and user roles table in my external DB that I would like to use to authenticate users against - is this possible? Do I have to use linked keys? If someone could point us in the right direction that would be great.

Thanks in advance - and sorry if I am hijacking this thread instead of aiding it…

---

<div class="post-metadata">

**Author:** ![Mohammed\_Imran](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mohammed\_Imran](https://community.dreamfactory.com/u/Mohammed_Imran)\
**Post date:** [November 9, 2015, 11:17am UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/3 "2015-11-09T11:17:47Z")

</div>

Any answers that can help me

---

<div class="post-metadata">

**Author:** ![Jonathan\_Irwin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jonathan_irwin/32/461_2.png) [@Jonathan\_Irwin](https://community.dreamfactory.com/u/Jonathan_Irwin)\
**Post date:** [November 9, 2015, 12:50pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/4 "2015-11-09T12:50:27Z")

</div>

Above where I said “linked keys” I meant lookup keys. I think the answer can be found using those - at least that is what an intro video seemed to suggest.

I think that you really need to let DreamFactory handle the users table and then you can have your user data in another column in your own DB. I am still figuring this out myself so I will keep you posted when I figure more out but I hope that can at least help a little bit.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [November 9, 2015, 1:56pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/5 "2015-11-09T13:56:15Z")

</div>

If the original question is just using an external db for the system db, that is pretty simple.  
In the root directory of your install there is a .env file. You will need to edit this file. By default the database section looks like this:

```
##------------------------------------------------------------------------------
## Database Settings
##------------------------------------------------------------------------------

DB_DRIVER=sqlite
DB_HOST=localhost
DB_DATABASE=dreamfactory
DB_USERNAME=df_admin
DB_PASSWORD=df_admin
DB_PORT=3306

```

Change the driver to mysql and fill out the rest of the information according to your specific database.

Then you will need to re-run the setup. You can do this from the command line. Navigate to the root of the install directory (where the .env file is).  
Clear the cache:

```
$ php artisan cache:clear

```

Then run the DreamFactory setup (this runs migrations, seeds the database, and sets up the admin user.)

```
$ php artisan dreamfactory:setup

```

Restart Apache (or whatever your web server is running.)

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [November 9, 2015, 2:02pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/6 "2015-11-09T14:02:07Z")

</div>

as far as @Jonathan_Irwin’s question I don’t believe this explicitly supported, though you may be able to make it work.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Irwin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jonathan_irwin/32/461_2.png) [@Jonathan\_Irwin](https://community.dreamfactory.com/u/Jonathan_Irwin)\
**Post date:** [November 9, 2015, 3:59pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/7 "2015-11-09T15:59:34Z")

</div>

Hey Drew

Thanks for the reply. In fact I think that the info above will really help me out.  
I’m not desperate to move the other fields to my own external DB, but it is nice that I can manage them in another remote DB…

---

<div class="post-metadata">

**Author:** ![Mohammed\_Imran](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mohammed\_Imran](https://community.dreamfactory.com/u/Mohammed_Imran)\
**Post date:** [November 9, 2015, 4:43pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/8 "2015-11-09T16:43:51Z")

</div>

Thanks @drewpearce

This is what I was looking for. Great 🙂

---

<div class="post-metadata">

**Author:** ![Jonathan\_Irwin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jonathan_irwin/32/461_2.png) [@Jonathan\_Irwin](https://community.dreamfactory.com/u/Jonathan_Irwin)\
**Post date:** [November 13, 2015, 8:01am UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/10 "2015-11-13T08:01:10Z")

</div>

Hi again,

Am I right to assume that using sqlsrv here with the right credentials would allow me to install the system db to a remote MS sql server?

After trying for a while I can’t get past this error:  
SQLSTATE[01002] Adaptive Server connection failed (severity 9)

edit:  
I see [here](https://github.com/dreamfactorysoftware/dreamfactory) that it is supported. Are there any more steps to get it to work? The db is accessible remotely

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [November 13, 2015, 1:58pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/11 "2015-11-13T13:58:28Z")

</div>

No, Microsoft SQL Server is not supported for the DreamFactory system DB. [Forum link here.](https://community.dreamfactory.com/t/azure-availability-set-and-scaling-dreamfactory-using-sql-server-as-configuration-db/1714/11?u=jeffreystables)

Note that the ‘sqlsrv’ option has already been removed from the DreamFactory setup command. We had just neglected to also remove it from the readme.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Irwin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jonathan_irwin/32/461_2.png) [@Jonathan\_Irwin](https://community.dreamfactory.com/u/Jonathan_Irwin)\
**Post date:** [November 13, 2015, 2:01pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/12 "2015-11-13T14:01:23Z")

</div>

Cool, thanks for letting me know… 🙂

---

<div class="post-metadata">

**Author:** ![Jeffry\_Reed](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@Jeffry\_Reed](https://community.dreamfactory.com/u/Jeffry_Reed)\
**Post date:** [September 11, 2016, 7:25pm UTC](https://community.dreamfactory.com/t/auth-via-external-db/1724/13 "2016-09-11T19:25:41Z")

</div>

Hello,

is there any update on the possibility to authenticate based on existing username/password store in external RDMS? Is this possible with lookup keys? It would seem that this should be possible one way or another, just not sure how.

thanks
