‹ Articles

How to Connect a Database to Laravel

If you want your Laravel project to use a MySQL database, follow these steps:

First, create your database in ServerPilot and copy the database name, username, and password.

Then, SFTP in to your server and open your Laravel app's .env file. This is a hidden file that will only appear if you followed our guide to configuring Cyberduck.

Finally, update the values for DB_DATABASE, DB_USERNAME, and DB_PASSWORD, replacing "homestead" and "secret" with your database credentials.

That's it! Now your Laravel app can access your MySQL database.

Still Have Questions?

Don't hesitate to contact us if you can't find the answers to your questions.