mnismael
mnismael

Reputation: 43

Adding .env file to UserFrosting

I am facing a problem linking my MySQL database to Userfrosting. The guide gives an example of adding a .enr file to the directory so that Userfrosting can read the database credentials, but it doesn't seem to work.

Can someone give me an in-depth tutorial on how to do it?

Here is the error code when running install.php:

Could not connect to the database '@/'.  Please check your database
configuration and/or google the exception shown below:
  Exception: SQLSTATE[HY000] [2002] No such file or directory
  Trace:
    #0 /Applications/XAMPP/xamppfiles/htdocs/myUserFrostingProject/migrations/install.php(63): PDO->__construct('mysql:host=;dbn...', NULL, NULL)
    #1 {main}

Upvotes: 1

Views: 217

Answers (1)

Louis Charette
Louis Charette

Reputation: 1331

For MAMP, the DB_HOST needs to be set to 127.0.0.1 instead of localhost. It's probably the same case with XAMPP. There's already an open pull request regarding this. See https://github.com/userfrosting/UserFrosting/pull/659.

Upvotes: 1

Related Questions