Using Connection URL 0:00When you provision an app server with Forge, you can also choose to install a database server alongside it. You can select MySQL, Postgres, or MariaDB to be installed as a service on your server. Alternatively, you can provision a database server which exclusively runs one of the database services. Your other servers can then connect to it through the use of a private network. Databases can be managed through the Database panel on our server's dashboard. This panel has a lot of features, so we're going to run through each one of these individually. The first thing that we'll see is that Forge has generated the database connection URL. This URL is a standard that can be entered into applications such as TablePlus. Let's go ahead and copy this into our pasteboard and switch to the TablePlus application. The next thing we need to do is create a new connection and click Import from URL.Let's go ahead and copy this into our pasteboard and switch to the TablePlus application. The next thing we need to do is create a new connection and click Import from URL. Now TablePlus has identified that we already have this URL in our pasteboard, and so we can just click Import. We can see that TablePlus has already pre-filled the connection details with everything that was in that URL. The only thing that we need to supply here is the database password. If you don't have the password, it will be included in the email that was sent to you when the server was finished provisioning. We can test this connection by clicking Test. And when we're happy that everything is connected, we can then click Connect. Now we're already connected to the Forge database here, but we can switch to our Zonda database and verify that our migrations have created all the tables. Yes, they have. Creating Databases and Users 1:27Now we're already connected to the Forge database here, but we can switch to our Zonda database and verify that our migrations have created all the tables. Yes, they have. And that's how we can use the database connection URL. The next thing we can do is create additional databases. If we think back to when we first provisioned our server, Forge created a default Forge database and database user for us. Now by default, the Forge user will also have access to all newly created databases. So when we're creating a new database, we can also create a user that will be granted explicit access to this database only. Let's create a blog database, and we'll also create an additional user called blog and a randomly generated password. Let's create that. And we can see that Forge is now installing the blog database for us. Syncing External Databases 2:14Let's create that. And we can see that Forge is now installing the blog database for us. Once that's created, we can switch to TablePlus, refresh our connection, and switch database to see the blog database. Now whilst we're looking at this databases panel, you'll also notice the Sync Databases button. This can be used to pull in databases that were created outside of Forge. So, for example, if we switch back to TablePlus and create a new database called demo. We now have this demo database. Let's open that up. Okay, cool. It's an empty database. Now let's refresh Forge, and you'll see here that we're not being shown the demo database. That's because Forge only knows about these databases because they were created through the Forge dashboard. Adding Database Users 2:55Now let's refresh Forge, and you'll see here that we're not being shown the demo database. That's because Forge only knows about these databases because they were created through the Forge dashboard. So if we want to get our demo database back into Forge, we can simply click Sync Databases. And then, yes, we do want to proceed with that. Now Forge is going to go and look for all the databases on our server, make sure that they don't already exist in Forge, and pull them in. And we can see that Forge has now synced in our demo database. Okay, the next thing is that we can add database users. So although we could create a database user while we were creating a new database, this particular way of creating database users allows us to specify which databases this user can access. So let's create a Laracost user, generate a new password, and we're going to give it access to the blog and demo databases. Editing and Deleting Users 3:36this particular way of creating database users allows us to specify which databases this user can access. So let's create a Laracost user, generate a new password, and we're going to give it access to the blog and demo databases. Okay, and we can see here that the Laracost user is being installed. Brilliant, that's done. Okay, so the other thing we can do here now is edit these users and either change the password or change the access levels. We could also select all databases or no databases. Finally, we can delete users as well. Let's delete this blog user because we don't need it. And just like that, the database user has gone. Now we can also change the Forge database user password. Changing Forge and Redis Passwords 4:22And just like that, the database user has gone. Now we can also change the Forge database user password. Changing this password outside of the Forge dashboard will mean that Forge is no longer able to manage your database for you. You'll need to contact the Laravel Forge support team to get this updated for you. Now the last thing we can do here is manage our Redis password. This won't really do too much, but it will mean that if we change this, we might need to update our environment file as well.