Skip to Content

Herd + DBngin

Herd is a blazing fast, native Laravel and PHP development environment for macOS. It provides everything that you need to get started with Laravel development. It ships with PHP, nginx, dnsmasq and Node.js.

You may think that Herd is for Laravel development only, but thanks to the foundational work of Laravel Valet, it ships with drivers for many other frameworks and web applications.

We will accompany Herd with DBngin, a database management tool that allows you to easily create, manage and connect to multiple databases.

Table of Contents

Installing Herd

Step 1: Download Herd

  1. Open your web browser and go to the Laravel Herd official website.
  2. Click on the “Download” button to download the Herd .dmg installer.

Step 2: Install Herd

  1. Once the download is complete, open the Herd.dmg file from your Downloads folder.
  2. Drag the Herd icon into the Applications folder.

Step 3: Launch Herd

  1. Open Spotlight Search by pressing Command (⌘) + Space, type Herd, and press Enter.
  2. If prompted with a warning about opening the app (since it’s not from the App Store), click “Open” to proceed.

Step 4: Start Using Herd

  1. When Herd opens, click “Start Herd” to start the built-in services like Nginx and PHP.
  2. Herd will automatically serve files from ~/Herd folder. But you can still put your files anywhere and link them later.

Step 5: Verify

After the installation process is complete you have a fully-functioning PHP and Laravel development environment. This means you can invoke the herd, php, laravel, and composer binaries from your terminal:

bash
herd --version php --version laravel --version composer --version node --version

Installing DBngin

Step 1: Download DBngin

  1. Open your web browser and go to the DBngin official website.
  2. Click on the “Download For Mac” button to download the DBngin .dmg installer.

Step 2: Install DBngin

  1. Open Spotlight Search, type DBngin, and press Enter.
  2. When DBngin opens, click “Create New Service” to set up a new database service.

Step 3: Choose Your Database

  1. Choose the database type you need (e.g., MySQL, PostgreSQL, or Redis).
  2. Select the version, port, and data directory, then click “Create”.

Step 4: Start the Database Service

  1. Click the “Start” button next to your new database service.
  2. DBngin will now start your database, and you can use it with your projects.

Step 5: Connecting to DBngin

Open the .env file in your project directory and update the database connection details, such as DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD, to match your DBngin settings.


Installing TablePlus (Optional)

  • To easily manage and connect to your databases, you can use TablePlus. A powerful and intuitive database management tool that supports various database systems, including MySQL, PostgreSQL, and SQLite.

  • You can still use phpMyAdmin for a lightweight solution.


Step 6: Download TablePlus

  1. Open your web browser and go to the TablePlus official website.

  2. Click Download For Mac to download the TablePlus .dmg installer.

  3. Once the download is complete, open the TablePlus.dmg file from your Downloads folder.

  4. Drag the TablePlus icon into the Applications folder.

    TablePlus Install

Step 7: Connect TablePlus to Your Database Service

  1. Make sure your database service is running in DBngin.

    DBngin Start

  2. Take note of the database connection details, such as Port.

    DBngin Connection

    Note

    By default, DBngin uses port 3306 for MySQL, root as the username and without password.

  3. Open TablePlus and Right Click to create new connection.

    TablePlus New Connection

  4. Select MySQL as the database provider.

    TablePlus Connection Info

  5. Enter the database connection details, such as port, username, and password.

    TablePlus Connection Set

    Click Test to verify you can connect to the database.

  6. Upon creating the connection, you can now manage and interact with your database using TablePlus.

Step 8: Create Database

  1. Start creating a database by clicking on the DB icon.

    TablePlus Connected

  2. A window will pop up and show you all available database with your connection. To create new database, click on the New… button.

    TablePlus Create Database 1

  3. Enter the database name and click OK.

    TablePlus Create Database 2

  4. Your new database will be created. Click on it then click Open to view database content.

    TablePlus Create Database 3

  5. You’re now viewing your newly created database without any tables. You can proceed to create a new table by clicking on the + icon on the bottom left corner.

    TablePlus Create Table

Advanced

DBngin Shell Integration

In order to use mysql or psql commands in your terminal, you will have to append DBngin’s binary to your PATH environment.

Step 1

First, open your terminal and determine which shell you are using:

powershell
echo $SHELL
  • If the output is similar to /bin/bash, you can use .bash_profile to update your PATH environment.
  • If the output is similar to /bin/zsh, then you can use .zshrc to update your PATH environment.
  • If the output is similar to /bin/sh, then you can use .profile to update your PATH environment.

Step 2

Go ahead and open your .bash_profile, .zshrc, or .profile file in your home directory.

Step 3

Add the following line to the end of the file:

powershell
# DBngin Binary Path export PATH="/Users/Shared/DBngin/mysql/8.0.33/bin:$PATH"

Update path to the location of your DBngin installed version of mysql binary.

Troubleshooting

Can’t connect to local MySQL server through socket

If you encountered the following error:

bash
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

This is because the mysqld.sock file is not present in the specified location and DBngin is unable to create one automatically. To fix this, make sure that DBngin has the correct permissions to access the /tmp directory.

  • Go to Settings > Security & Privacy > Privacy > Full Disk Access.
  • Locate mysqld in the list and click the checkbox to allow it.

    You may need to click the lock icon on the bottom left corner of the window to allow changes to be made.

Last updated on