Setting Up MySQL with DBngin for Laravel 12 Development
Welcome back to our Laravel 12 setup series! In the previous post, we got our PHP environment set up using Herd (or MAMP) and successfully installed a fresh Laravel 12 project. In this lesson, we're going to create a dedicated home for our application data.
While tools like MAMP include MySQL, they can present some workflow challenges. In this guide, we'll configure DBnginโa streamlined and user-friendly database server manager for macOS and Windows. It enables you to run multiple versions of MySQL, PostgreSQL, and Redis simultaneously, without version conflicts.
By the end of this tutorial, you'll have a clean, isolated database server configured for your Laravel 12 application. This setup will work seamlessly with any application that requires database connectivity, not just Laravel.
๐ฏ What You'll Learn
- How to install and configure DBngin
- Setting up MySQL for Laravel development
- Creating databases and managing connections
- Connecting Laravel 12 to your database
- Testing the database connection
๐ Prerequisites
- Laravel 12 project set up (Part 1)
- Basic terminal knowledge
- macOS or Windows machine
๐ Step 1: Download and Install DBngin
1.1 Get DBngin
- Visit the official DBngin website at dbngin.com
- Click the 'Download For Mac' button (or 'Download For Windows' if you're on Windows)
1.2 Install the Application
- Drag the DBngin app into your Applications folder
- Double-click the DBngin icon in Applications to launch it
That's all there is to it! You've successfully installed DBngin.
๐๏ธ Step 2: Starting Your Database Server
2.1 Launch and Configure
- Open the DBngin applicationโyou'll see a clean, intuitive interface
- By default, DBngin offers the latest versions of MySQL and PostgreSQL
- For Laravel projects, MySQL is the popular choice
2.2 Create MySQL Connection
- Click the plus icon (+) at the top
- Select MySQL from the options
- Choose the version compatible with your processor
- Give it a memorable name (e.g., "Laravel Dev")
- Keep the default port (3306)
2.3 Start the Server
- Click "Create" - DBngin will download MySQL and set up the connection
- Click "Start" - you'll see it switch to "Stop" with a green indicator
Congratulations! Your database server is now running! But we're not done yetโlet's connect to it and create our database.
๐ Step 3: Connecting and Creating Your Database
Think of DBngin as a brand-new apartment building with no individual apartments. Let's create a room (database) for our Laravel app.
3.1 Find MySQL Client Path
- After starting your MySQL connection, click the right arrow (โ) button
- Select the second option to open terminal with the correct path
The path will look something like:
/Users/Shared/DBngin/mysql/8.0.33/bin
3.2 Access MySQL Shell
# Navigate to MySQL bin directory
cd /Users/Shared/DBngin/mysql/8.0.33/bin
# Access MySQL shell
./mysql -u root -p
When prompted for a password, press Enter (DBngin's root user has no password by default).
Your terminal prompt should change to mysql>, indicating you're now inside the MySQL monitor.
3.3 Create Database for Laravel
-- Create database for your Laravel project
CREATE DATABASE laravel_12_app;
-- Verify the database was created
SHOW DATATBASES;
You should see your new database in the list!
๐ Step 4: Connecting Laravel 12 to Your Database
4.1 Update Environment Configuration
Navigate to your Laravel 12 project and open the .env file. Find the database configuration section:
Before:
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
After:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_12_app
DB_USERNAME=root
DB_PASSWORD=
Note: DB_PASSWORD is left empty as DBngin's root user has no password by default.
โ Step 5: Testing the Connection
5.1 Check Database Status
Laravel provides Artisan commands to check database status and run migrations.
# Navigate to your project root
cd path/to/your/laravel-project
# Check database connection and info
php artisan db:show
You should see output showing your database connection is successful!
Run Migrations
# Run database migrations
php artisan migrate
If this command runs without errors, congratulations! You've officially set up your database and connected it to Laravel 12 perfectly.
๐ You're All Set!
You've just leveled up your local development setup! ๐ By using DBngin, you now have a clean, manageable, and powerful database server dedicated to your projects. Combined with Herd for PHP and the Laravel installer, you're all set with a professional-grade local environment for building amazing things with Laravel 12!
๐ Quick Recap
โ
Downloaded and installed DBngin
โ Started the MySQL server
โ Created a database via command line
โ Updated Laravel's .env file
โ Tested the connection with Artisan
๐ What's Next?
In the next part of our series, we'll dive into:
- Choosing and setting up a code editor
- Essential tools for modern Laravel development
- Configuring your development workflow.
๐ฌ Questions?
Got stuck or have a question? Feel free to drop a comment belowโI'd love to help! ๐
Enjoyed this tutorial? Check out more Laravel content on Dinesh Stack and follow me for more web development tips!


Top comments (0)