Start a new Laravel app

Use Laravel Installer to install a new laravel project

After cd to the location where I want to contain the project folder for this project, run:

laravel new projectname


Install TailwindCSS

Follow their guide to installing in Laravel here:


Run Vite & Laravel

In one terminal run vite:

npm run dev

In another terminal run laravel:

php artisan serve


Create a MySQL database

We'll assume that the .env file specifies that we're using mysql. You should have something like this in env for your local environment:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=

MySQL should probably already be running on your mac, and if so, then you can go ahead and connect to it:

use the username root and no password, by entering this:

mysql -uroot -p

If you see an error like this: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) then it probably means you're not running MySQL on your mac.

To start it, run this:

brew services start mysql

Then try mysql -uroot -p again

If it asks for a password, just click return.

If successful, then you'll be in mysql, and see this

Now, in mysql, create the database and name it whatever the project name is. The ; is important to include at the end.

create database projectname;

When finished, exit mysql with command+D or just type exit

Now back in the regular command line, run:

php artisan migrate

If you didn't create the database earlier, this command should prompt you to create a database now. Click yes if you see that prompt.

Then this will create and run a few migrations.


Connect to the local database using TablePlus

  • Choose MySQL

  • username: root

  • password: blank

  • database name: the project name (or whatever you named the db)

  • Test it and save


Last updated