Get the App
SLTechnology News&Howtos  ›  Database  › 

Laravel database connection problem

Shulou Source: shulou.com Published: 2022-06-01 08:58:51 11月15日 Update

1. Modify the configuration file / .nev

DB_HOST=127.0.0.1 / / database address DB_PORT=3306 / / database port DB_DATABASE=database / / database name DB_USERNAME=root / / database account DB_PASSWORD=root / / database password

two。 Start testing whether the connection is successful

/ App/Http/routes.php routing code is as follows (can be customized)

Route::get ('dbtest','Admin\ IndexController@dbtest')

3. New IndexController Controller

/ App/Http/Controllers/IndexController controller code is as follows (can be customized)

Tags: Data database code name success prefix address password controller file port account control test browsing configuration questions FAQ browser Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi vpn Shulou Tech Info Shulou Technology