How do I set up phpMyAdmin on a Laravel Homestead box?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Setting up phpMyAdmin on a Laravel Homestead Box: A Comprehensive Guide for Developers
Introduction: In this article, we will guide you through setting up phpMyAdmin on your Laravel Homestead virtual machine to efficiently manage and administer MySQL databases. Follow our step-by-step instructions and ensure that your setup is smooth sailing from the start. As a reminder, always use version control on your projects since it helps maintain consistency across team members and environments.
Body:
1. Ensure Laravel Homestead Installation: Before we begin with the installation of phpMyAdmin, make sure you have properly installed Laravel Homestead. If not, check the official documentation for installing Homestead using Vagrant at https://laravelcompany.com/blog/homestead-the-official-laravel-development-environment-setup
2. Installing phpMyAdmin: Once Laravel Homestead is set up, open your command line interface (CLI) in the terminal and run the following commands:
```bash
sudo apt-get install phpmyadmin
```
This command will handle the installation process for you. It usually retrieves the latest version of phpMyAdmin from the repository. However, if you wish to choose a specific version, update the command to:
```bash
sudo apt-get install phpmyadmin/[VERSION_NUMBER]
```
where [VERSION_NUMBER] denotes your preferred version number. Remember that using older versions might not be supported or may cause compatibility issues with modern PHP versions.
3. Configure phpMyAdmin: After the installation, you'll need to set up a few configurations to make it work smoothly on your Homestead box. To achieve this, run:
```bash
sudo cp /etc/phpmyadmin/config-dist.inc.php /etc/phpmyadmin/config.inc.php
sudo vim /etc/nginx/sites-available/laravel-homestead.conf
```
Edit the 'server_name' directive in the nginx configuration file to match your localhost address for Laravel Homestead:
```vim
server_name localhost;
```
Save and exit the editor. To make these changes take effect, restart nginx with this command:
```bash
sudo service nginx restart
```
4. Access phpMyAdmin: Your Laravel Homestead with installed phpMyAdmin can now be accessed through your browser by navigating to http://localhost/phpmyadmin. Remember, you might need to include the port number if it's different than 80. For example, in case of Homestead, the default URL would be http://192.168.10.10:8000/phpmyadmin. This process should work for other popular application servers like Apache2 or Lighttpd if you had selected those options during your Laravel installation.
5. Connecting to MySQL databases with phpMyAdmin: To create a new database, click on "Databases" from the left sidebar in phpMyAdmin. Type in the name of your new database and hit "Create". Then go to "Privileges" to create users for that database. Once you've created a user, assign privileges accordingly by granting them appropriate roles from within the "User Level Access Control (ULAC)" section.
6. Securing Laravel Homestead: To prevent unauthorized access to phpMyAdmin and your MySQL databases, consider setting up an authentication method like SSL/TLS (Secure Sockets Layer / Transport Layer Security), which is a data encryption method that protects user credentials during transfer over the internet.
7. Conclusion: Setting up phpMyAdmin is crucial for efficiently managing and administering your MySQL databases on Laravel Homestead. While the steps might seem overwhelming at first, following this guide will help you accomplish your database management tasks with ease. If you need further assistance or run into an issue, consider seeking guidance from the Laravel community or refer to the official documentation available for each tool and application.
Remember to keep your Laravel Homestead environment up-to-date by updating packages and dependencies using Composer and running homestead update when required. Happy coding!