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
- Herd + DBngin
Installing Herd
Step 1: Download Herd
- Open your web browser and go to the Laravel Herd official website .
- Click on the “Download” button to download the Herd
.dmg
installer.
Step 2: Install Herd
- Once the download is complete, open the
Herd.dmg
file from your Downloads folder. - Drag the Herd icon into the Applications folder.
Step 3: Launch Herd
- Open Spotlight Search by pressing
Command (⌘) + Space
, type Herd, and press Enter. - 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
- When Herd opens, click “Start Herd” to start the built-in services like Nginx and PHP.
- 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:
herd --version
php --version
laravel --version
composer --version
node --version
Installing DBngin
Step 1: Download DBngin
- Open your web browser and go to the DBngin official website .
- Click on the “Download For Mac” button to download the DBngin
.dmg
installer.
Step 2: Install DBngin
- Open Spotlight Search, type DBngin, and press Enter.
- When DBngin opens, click “Create New Service” to set up a new database service.
Step 3: Choose Your Database
- Choose the database type you need (e.g., MySQL, PostgreSQL, or Redis).
- Select the version, port, and data directory, then click “Create”.
Step 4: Start the Database Service
- Click the “Start” button next to your new database service.
- 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
-
Open your web browser and go to the TablePlus official website .
-
Click Download For Mac to download the TablePlus
.dmg
installer. -
Once the download is complete, open the
TablePlus.dmg
file from your Downloads folder. -
Drag the TablePlus icon into the Applications folder.
Step 7: Connect TablePlus to Your Database Service
-
Make sure your database service is running in DBngin.
-
Take note of the database connection details, such as Port.
NoteBy default, DBngin uses port
3306
for MySQL,root
as the username and without password. -
Open TablePlus and Right Click to create new connection.
-
Select MySQL as the database provider.
-
Enter the database connection details, such as port, username, and password.
Click Test to verify you can connect to the database.
-
Upon creating the connection, you can now manage and interact with your database using TablePlus.
Step 8: Create Database
-
Start creating a database by clicking on the DB icon.
-
A window will pop up and show you all available database with your connection. To create new database, click on the New… button.
-
Enter the database name and click OK.
-
Your new database will be created. Click on it then click Open to view database content.
-
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.
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:
echo $SHELL
- If the output is similar to
/bin/bash
, you can use.bash_profile
to update yourPATH
environment. - If the output is similar to
/bin/zsh
, then you can use.zshrc
to update yourPATH
environment. - If the output is similar to
/bin/sh
, then you can use.profile
to update yourPATH
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:
# 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:
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.