Ion Auth (Codeigniter) - How to use different database -


Is it possible to use different databases to authenticate the user through Ion Aith? I want to create a dedicated database only for user authentication, therefore, this transaction should be different from the database How to do this?

Thank you.

In short ... yes It is possible to use a different database for your authentication. In addition to config, you will need to create a second database configuration in your application / config / database.php file.

  $ dB ['default'] ['hostname'] = "localhost"; $ Db ['default'] ['username'] = "root"; $ Db ['default'] ['password'] = ""; $ Db ['default'] ['database'] = "db_name"; $ Db ['default'] ['dbdriver'] = "MySQL"; $ Db ['authentication'] ['hostname'] = "localhost"; $ Db ['Authentication'] ['username'] = "root"; $ Db ['authentication'] ['password'] = ""; $ Db ['authentication'] ['database'] = "auth_db_name"; $ Db ['Authentication'] ['dbdr'] = "MySQL";  

For further reference refer to -

You need to modify your ion_auth model to use this second DB configuration, which is set when you load the database will do.

  $ auth_db = $ this-> Load-> Database ('authentication', correct);  

Then $ this-> Change all database queries in the model by changing db with $ auth_db .

Therefore, $ this-> Db- & gt; Select ('password, salt') will be $ auth_db-> select ('password, salt') .

For further reference refer to -

Hope that helps!


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -