Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kaungsoe's avatar

How to create new database in Homestead on mac

i'm using homestead and use default database. I want to create new mysql database for each project.

0 likes
5 replies
mstnorris's avatar

Use Sequel Pro. It's a really nice free GUI for MySQL.

As for actually creating it, either use Sequel Pro, or you can do it from the command line. See this tutorial.

  1. vagrant ssh or homestead ssh depending on how you SSH into Homestead
  2. Connect to MySQL mysql -uhomestead -p
  3. Enter secret (Homestead's default MySQL password) 4, CREATE DATABASE your_database_name;
1 like
RomainLanz's avatar
Level 14

You can edit your Homestead.yaml file to create databases.

databases:
    - database1
    - database2
    - database3

After that, you can run vagrant provision (or homestead provision if you have the package).

3 likes
mstnorris's avatar

Or what @RomainLanz said however I don't like provisioning the server over and over again as that take a little time and also removes your data (at least it used to, I'm not sure if it still does as I always create my databases manually now, the ways I mentioned above).

Prullenbak's avatar

Newer version of homestead doesn't delete data on provision anymore. I usually do it like @RomainLanz said. You have to provision anyway if you want to map another url to a directory (for a new project).

mstnorris's avatar

@Prullenbak I thought that was the case as I noticed the other day that my data had persisted when I issued the provision command. If that is the case, then I'd say either update your Homestead.yaml and run vagrant provision or using Sequel Pro if you're going to run the serve domain.app /path/to/project/public command.

Please or to participate in this conversation.