The. env file is a configuration file, including database configuration information, view config->database.php, connections contains the configuration of all databases, and you can select the database to use in default. In the database configuration, the env (' db_host ', ' localhost ') is the information that reads the. env configuration file. The second parameter is the default parameter.
We use MySQL database, modify. ENV:
Db_host=localhost
db_database=laravel
db_username=root
db_password=
Creating a laravel database in MySQL
Mysql-u root
CREATE DATABASE laravel
To view the MySQL configuration:
' MySQL ' => ['
driver ' => ' mysql ',
' host ' => env (' db_host ', ' localhost '),
' database ' = > env (' db_database ', ' Forge '),
' username ' => env (' db_username ', ' Forge '),
' password ' => env (' Db_ PASSWORD ', '),
' charset ' => ' UTF8 ',
' collation '
=> ' utf8_unicode_ci ', ' prefix ' = > ',
' strict ' => false,
],
In the config subdirectory, include all of the configuration files and view them.
The above mentioned is the whole content of this article, hope to be able to learn Laravel5 frame to be helpful to everybody.