How do I set up phpMyAdmin on a Laravel Homestead box?

The answer from Nikos Gr worked for me; however I needed to amend steps 2 and 3 as my host system has issues creating the symlink.

I changed:

sudo ln -s /usr/share/phpmyadmin/ /home/vagrant/Code/phpmyadmin
cd ~/Code && serve phpmyadmin.app /home/vagrant/Code/phpmyadmin

To:

cd ~/Code && serve phpmyadmin.app /usr/share/phpmyadmin/

(Couldn't comment on the original solution as my rep isn't high enough!)


A simplified version of Jyeon's Answer. You don't need to share the ~/Code folder in the Homestead.yaml file:

folders:
    - map: /Users/{yourName}/Code/phpMyAdmin
      to: /home/vagrant/Code/phpMyAdmin

Just download the latest version of PhpMyAdmin from PhpMyAdmin and put the unzipped file in the ~/Code/phpMyAdmin folder and just follow the 2 step here:

Step 1: Open up homestead.yaml file and add these lines

sites: - map: phpmyadmin.app to: /home/vagrant/Code/phpMyAdmin

Step 3: Open up your hosts file and add this line:

192.168.10.10 phpmyadmin.app

Now run the vagrant reload --provision command and you're good to go.

Open up the phpmyadmin.app address in your browser and you'll see the phpmyadmin interface.


Step 1:

Go to the phpMyAdmin website, download the latest version and unzip it into your code directory

Step 2:

Open up homestead.yaml file and add these lines

folders:
    - map: /Users/{yourName}/Code/phpMyAdmin
      to: /home/vagrant/Code/phpMyAdmin
sites:
    - map: phpmyadmin.test
      to: /home/vagrant/Code/phpMyAdmin

Step 3:

Open your hosts file and add this line:

127.0.0.1 phpmyadmin.test

Step 4:

You may need to run vagrant provision to load the new configuration if vagrant is already running.


Thats it

Go to http://phpmyadmin.test:8000. It should work from there. Great thing about this method is that if you ever need to destroy your box, you won't ever have to set up phpMyAdmin again so long as you keep your homestead.yaml file and phpMyAdmin in your code directory.

===========

Important update from DaneSoul:

I tried this instruction on Homestead 5.3 and have met a problem "No input file specified" when trying open http://phpmyadmin.test.

And finnaly I found solution:

You need unpack phpmyadmin to

/home/vagrant/Code/phpMyAdmin/public

And write in homestead.yaml

- map: phpmyadmin.test
  to: /home/vagrant/Code/phpMyAdmin/public

So almost all the same, but this /public directory in paths makes it working!

Also, in my configuration I use http://phpmyadmin.test, not http://phpmyadmin.test:8000.

Update Note: Follow this article to change your domain extension.


Option 1:

This will install the latest version of PhpMyAdmin from a shell script I've written. You are welcome to check it out on Github.

  1. Run the following command from your code/projects directory:

     curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | bash
    

Option 2:

This will install PhpMyAdmin (not the latest version) from Ubuntu's repositories. Assuming that your projects live in /home/vagrant/Code :

  1. sudo apt-get install phpmyadmin Do not select apache2 nor lighttpd when prompted. Just hit tab and enter.

  2. sudo ln -s /usr/share/phpmyadmin/ /home/vagrant/code/phpmyadmin

  3. cd ~/Code && serve phpmyadmin.test /home/vagrant/code/phpmyadmin

Note: If you encounter issues creating the symbolic link on step 2, try the first option or see Lyndon Watkins' answer below.

Final steps:

  1. Open the /etc/hosts file on your main machine and add:

     127.0.0.1  phpmyadmin.test
    
  2. Go to http://phpmyadmin.test:8000