I'm making a course on Laravel Sanctum: MasteringAuth.com

Creating a database client connection

Constantin Druc ยท 13 Jun, 2021

[00:00] If we open thinker using Sail, and create a user using the user factory, we'll see that we don't get any errors. We can even fetch the users, and here it is right here. That's because when we create an application using Sail, the database part is also taken care of. All we need to do is to connect to it.

[00:31] Here's how to do it. Open your database, client; in my case I'm using TablePlus, click create a new connection, pick mysql, create, and then here, on the connection name, you can type in whatever you want. I'll name it tallpal sail, leave the host and the port as they are, and to grab the username open your environment file, go to the db connection details, grab the username, grab the password, and the database name.

[01:17] Now we can test the connection, and since they are all green, we can click connect; and here it is; our database. And this is the user we've created using thinker.