Configure the MySQL database in Laravel from SQLite

- Andrés Cruz

En español
Configure the MySQL database in Laravel from SQLite

In this section we are going to configure the database. Depending on the operating system you use, the steps will be different.

It is also important to note that these steps should only be realized if you created the project using the Laravel installer and selected MySQL as the database or if you updated the project to use MySQL.

If you did not choose MySQL, from the env file you will see:

.env

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=

That is, we are using SQLite, the database in Laravel 11 is located in:

database\database.sqlite

To view it, you can use a VSC extension or install drivers such as:

https://sqlitebrowser.org/

If you want to switch to MySQL, you must manually create a MySQL database and configure the parameters:

.env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=larafirststeps
DB_USERNAME=root
DB_PASSWORD=
Andrés Cruz

Desarrollo con Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz en Udemy

Acepto recibir anuncios de interes sobre este Blog.