63

I installed it by running sudo apt-get install phpymyadmin and then running

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html and sudo service nginx restart

but it's not working.

Note: I didn't select any of the apache2 or lighttpd options when installing.

Boann
  • 48,794
  • 16
  • 117
  • 146
Nikos Grigoriadis
  • 2,912
  • 4
  • 22
  • 29

15 Answers15

138

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

Nikos Grigoriadis
  • 2,912
  • 4
  • 22
  • 29
  • @Nikos Gr is there an easy way like this for updating to a new phpmyadmin verions? – Markus Schober Aug 06 '14 at 07:21
  • You could install the new version from scratch. – Nikos Grigoriadis Aug 06 '14 at 11:21
  • 2
    I got the link error as "ln: failed to create symbolic link ‘phpmyadmin’: Protocol error". So I changed the link destination to home/vagrant/phpmyadmin" in the 2nd and 3rd step and things started to works perfectly fine. – Senthil Aug 17 '14 at 18:18
  • @NikosGr i ran your command from the wrong folder, i did it in my home folder. What is the clean way to remove now phpmyadmin from there? Thanks – GabAntonelli Mar 01 '16 at 17:29
  • If running on Windows, **Run as Administrator** -- If you're running a virtual box on windows, you'll want to run your shell (Cygwin, for example) "As Administrator" to prevent the symbolic link error. – Wes Foster Jun 06 '17 at 21:39
  • 1
    Initially all worked, but once i have installed a new project and had to run `homestead up --provision` serving ended, solved it by mapping phpmyadmin.app to `/home/Code/vagrant/phpmyadmin` – Andrejs Gubars Sep 12 '17 at 08:11
  • For me on executing sudo ln -s /usr/share/phpmyadmin/ /home/vagrant/Code/phpmyadmin" ln: failed to create symbolic link - Protocol error – ShivarajRH Nov 14 '17 at 13:04
  • One more issue, vagrant@homestead:~$ cd ~/Code && serve phpmyadmin.app /home/vagrant/Code/phpmyadmin **dos2unix: converting file /vagrant/scripts/serve-laravel.sh to Unix format ...** – ShivarajRH Nov 14 '17 at 15:05
  • 1
    Doesn't work, install works but then at http://phpmyadmin.app:8000 all I see is the Laravel welcome page. – Chriz74 Nov 30 '17 at 16:42
  • After a lot of searching, I found that I had to edit the "phpmyadmin.app" file in "/etc/nginx/sites-enabled" to use php 7.2 instead of the standard php version, as explained here by Miguel: https://laracasts.com/discuss/channels/general-discussion/502-bad-gateway-nginx-197-in-homestead-laravel-5?page=1 I also used .test instead of .app –  Dec 27 '17 at 10:26
  • 2
    Do not use the `serve` command. Just add the phpmyadmin site in Homstead.yaml, then run `vagrant provision` or `homestead provision`, and there you go. And don't forget to update your host file. – trogne Nov 08 '18 at 21:42
  • Option 2 step 1&2 and modifying `homestead.yaml` as mentioned below (step 2&3) works for me :D – ginad May 14 '20 at 06:33
124

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.

MD Iyasin Arafat
  • 763
  • 1
  • 12
  • 22
Jeff
  • 2,018
  • 2
  • 15
  • 18
  • I tried this and http://phpmyadmin.app:8000 loads to the laravel homepage exactly like http://homestead.app/. What could I be missing. – Brian Nov 21 '14 at 19:17
  • 10
    Try running `vagrant provision` or `vagrant reload --provision` and try loading phpmyadmin.app:8000. – Jeff Nov 22 '14 at 15:49
  • 9
    Elegant solution, worked out of the box with Homestead. Just had to remember that the default username/password is Homestead/secret, not root/[null]! – Paul Dec 08 '14 at 18:33
  • Same issue as Brian, and provision the machine again doesn't work. Even tried to restart the web server manually still same thing. Loads the laravel app by default – RaduM Mar 18 '15 at 14:56
  • Check to see if phpMyAdmin is in your home directory in your VM. – Jeff Mar 19 '15 at 02:08
  • 3
    Ok I managed to find what the issues is at least for me. Looks like windows doesn't like .app for some reason and nginx doesn't route to the proper folder because the request is not coming from phpmyadmin.app so it defaults to the laravel folder. All I did was to change the nginx config to use phpmyadmin instead of phpmyadmin.app. SSH into the machine and run `sudo nano /etc/nginx/sites-available/phpmyadmin.app` edit this line `server_name phpmyadmin.app;` to this `server_name phpmyadmin;` and that is it. Also don't forget you hosts file will be now `192.168.10.10 phpmyadmin`. – RaduM Mar 19 '15 at 11:07
  • 5
    In case username/password 'Homestead/secret' not working, try this one 'homestead/secret', mine work with the lowercase. Hope it helps someone. Thanks – Rahul Mangal Sep 05 '16 at 07:35
  • Okay, I tried the user/pass and I could logged in BUT I got that message: "No input file specified." Very very annoying, when everybody write "a that's perfect" or "working like a charm", but it doesn't... I followed the instructions about the Homestead install, and it doesn't work properly... – Zsolt Takács Oct 17 '16 at 08:58
  • Sounds like an nginx config issue. You only get that after logging in? What is the url you are at when after you log in? – Jeff Oct 18 '16 at 05:37
  • Can you rewrite your updated answer to make it more clear? When you say to unpack, you mean in vagrant? How do you even unpack in vagrant? – user2315641 Dec 23 '17 at 17:37
  • Works fine with Homestead 7.19.2 (without putting phpMyAdmin sources into `public` subdirectory). Thanks a lot for the guidelines! – AntonK Nov 18 '18 at 00:04
  • I can also confirm that the `public` subdirectory is not needed. The error `"No input file specified"` seems to point out that your map path is incorrect. Maybe it is `/home/vagrant/Code/phpmyadmin/public` instead of `/home/vagrant/Code/phpMyAdmin/public` or something. – Adam Feb 07 '19 at 23:22
  • This answer still works in 2022. Just upgraded to Laravel 9 and had issues with phpmyadmin because of the framework update. Used this answer to upgrade phpmyadmin to the most recent version 5.2.0 and the system now works, errors and deprecation notices are all cleared up. – pandorabacchus Jun 16 '22 at 01:16
13

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!)

Lyndon Watkins
  • 188
  • 1
  • 7
11

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.

Tom Sabel
  • 3,935
  • 33
  • 45
asmmahmud
  • 4,844
  • 2
  • 40
  • 47
  • This was the first way i got to work, got a bad gateway using the script in step 1 suggested by @Nikos – blamb Oct 13 '17 at 18:44
6

Install phpMyAdmin

  • SSH into Homestead vagrant box with vagrant ssh and type the following command:

     sudo apt-get install phpmyadmin
    
  • When prompted to select the Web server, select apache2 and press Enter, just to get pass it.

  • When prompted to config database for phpmyadmin with dbconfig-common, select Yes and press Enter.

  • When prompted for Password of the database's administrative user, enter secret and press Enter.

  • When prompted for MySQL application password for phpmyadmin, enter secret and press Enter.

  • When prompted for Password confirmation, enter secret again and press Enter.

Then Create and config site for Nginx

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html/phpmyadmin

cd /etc/nginx/sites-available
sudo cp homestead.app phpmyadmin.app

sudo sed -i 's/homestead.app/phpmyadmin.app/g' /etc/nginx/sites-available/phpmyadmin.app
sudo sed -i 's/home\/vagrant\/Code\/Laravel\/public/usr\/share\/nginx\/html\/phpmyadmin/g' /etc/nginx/sites-available/phpmyadmin.app

sudo ln -s /etc/nginx/sites-available/phpmyadmin.app /etc/nginx/sites-enabled/phpmyadmin.app
sudo service nginx restart
sudo service php5-fpm retart

Adding phpMyAdmin.app to your hosts file

 127.0.0.1   phpmyadmin.app

Navigate to http://phpmyadmin.app:8000 and you should now see phpMyAdmin login page.

More info available here if you need it

Laurence
  • 58,936
  • 21
  • 171
  • 212
5

A variation on Nikos Gr's answer that seemed a bit simpler (in that it doesn't require a new symbolic link for each project on your Homestead box) and worked for me.

  1. Inside the Homestead box, run sudo apt-get install phpmyadmin. Don't select any of the options during install.
  2. On your host machine, add the following lines to your Homestead.yaml file:

    - map: phpmyadmin.dev to: /usr/share/phpmyadmin

  3. On your host machine, add the following line to your hosts file:

    192.168.10.10 phpmyadmin.dev

...and Homestead's phpMyAdmin will be available at phpmyadmin.dev

Community
  • 1
  • 1
Nick F
  • 9,781
  • 7
  • 75
  • 90
3

You can install phpmyadmin automatically when you vagrant up or provision your homestead by adding the following snippet to your Homestead\scripts\homestead.rb file after # Update Composer On Every Provision

# Install phpMyAdmin on every provision
    config.vm.provision "shell" do |s|
      s.inline = "curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | sh"
    end

Your hoomestead.rb file should now look somehow like this

class Homestead
  def Homestead.configure(config, settings)
    # Configure The Box
    config.vm.box = "laravel/homestead"
    config.vm.hostname = "homestead"

    # Configure A Private Network IP
    config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"

some other entries are truncated to keep this short

    # Update Composer On Every Provision
    config.vm.provision "shell" do |s|
      s.inline = "/usr/local/bin/composer self-update"
    end

    # Install phpMyAdmin on every provision
    config.vm.provision "shell" do |s|
      s.inline = "curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | sh"
    end

    # Configure Blackfire.io
    if settings.has_key?("blackfire")
      config.vm.provision "shell" do |s|
        s.path = "./scripts/blackfire.sh"
        s.args = [settings["blackfire"][0]["id"], settings["blackfire"][0]["token"]]
      end
    end
  end
end

Save file and run vagrant destroy then vagrant up or just vagrant reload

NB: This uses Nikos Gr script located here https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh

Emeka Mbah
  • 16,745
  • 10
  • 77
  • 96
1

Finally it worked for me, few things I had to fix:

Homestead.yaml file:

- map: phpmyadmin.test
  to: /home/vagrant/code/phpmyadmin/

I had to delete /public from the end. I installed phpmyadmin (after vagrant ssh command from Homestead directory) into the 'code' folder where the other projects are. When 'code' is with lowercase, it has to be everywhere so (or other way around): folder name, yaml file or even after installation performing these commands:

sudo ln -s /usr/share/phpmyadmin/ /home/vagrant/code/phpmyadmin
cd ~/code && serve phpmyadmin.test /home/vagrant/code/phpmyadmin
GregTaylor
  • 11
  • 2
1

This is the most simple solution. No mapping and all needed.

  1. Download latest phpmyadmin version from here https://www.phpmyadmin.net/downloads

  2. Make a folder named phpmyadmin inside your main root/public folder and unzip phpmyadmin here.

  3. Run yourwebsite.com/phpmyadmin

Sahil Jain
  • 89
  • 1
  • 6
1

I am writing here the way I followed to make my local vagrant environment work-friendly.

Step 1 - Start the vagrant and login

vagrant up 
vagrant ssh

Step 2 - Go to your correct directory. (Depends on your file tree)

cd <VagrantDirectory>

Step 3 - Install phpmyadmin.

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

Step 4 - Configure the Homestead.yaml

map: phpmyadmin.test
to: /home/vagrant/<VagrantDirectory>/phpmyadmin

Step 5 - Reload the vagrant.

vagrant reload

Step 6 - Configure phpmyadmin

Go to your phpmyadmin directory. Copy config.sample.inc.php to config.inc.php

cp config.sample.inc.php config.inc.php

Step 7 - Edit config.inc.php with your text editor and place your new configuration there.

//Comment out the old configuration that was already here.
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'localhost'; // Also works with the IP address.
$cfg['Servers'][$i]['user'] = 'homestead'; // Username of MySQL, Default is homestead.
$cfg['Servers'][$i]['password'] = 'secret'; // Password. Default password is secret
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['CheckConfigurationPermissions'] = false; // Since you are on local, Leave this false.

Step 8 - Now browse your fresh PHPMyAdmin on your favorite browser.

http://phpmyadmin.test

Disapamok
  • 1,426
  • 2
  • 21
  • 27
0

For another alternative that I found super simple and that worked right out of the box I set up a new Nginx site from inside the Homestead box using the serve.sh script:

serve adminer.app /home/vagrant/Code/adminer/

And then in there I dropped the one page successor to phpmyadmin, Adminer. I also renamed it to "index.php" to make it just work. Then after adding the adminer.app entry to my hosts file I was good to go.

Had not used a web based MySQL interface in years since I just didn't like maintaining phpMyAdmin but this one is sweet. One file (plus an optional CSS file if you want a nicer theme) and that is all. Easy to maintain and update.

noeldiaz
  • 906
  • 5
  • 5
  • Hey I tried this, and I get a 403 when I go to adminer.app:8000. Any idea why this is happening? – Chris Jun 23 '14 at 18:29
0

In my case accepted solution works ok except:

$ cd ~/Code && serve phpmyadmin.app /home/vagrant/Code/phpmyadmin
dos2unix: converting file /vagrant/scripts/serve.sh to Unix format ...
 * Restarting nginx nginx                                                                                                                            [fail] 
php5-fpm stop/waiting
php5-fpm start/running, process 4112

For an unknown reason serve command files creating configuration file as seen in:

$ sudo tail -f /var/log/nginx/error.log 
2015/03/18 11:54:16 [emerg] 3671#0: invalid number of arguments in "listen" directive in /etc/nginx/sites-enabled/phpmyadmin.app:2

Edit config:

$ editor /etc/nginx/sites-enabled/phpmyadmin.app

and add 80 to Listen directive at line 2. Apply changes with:

$ sudo service nginx reload
Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
0

As I couldn't comment on the Jyeon solution as my rep isn't high enough, I contribute with this answer; worked for me in Linux (openSUSE Leap) with Vagrant 1.8.1 and laravel/homestead (virtualbox, 0.4.0):

Step 1:

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

Step 2:

Add to your Homestead.yaml file the following lines:

folders:
    - map: ~/Code/phpMyAdmin
      to: /home/vagrant/Code/phpMyAdmin

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

Step 3:

Add to your hosts file the following line:

192.168.10.10   phpmyadmin.app

Step 4:

After start your vagrant environment and connects to machine via SSH, set your virtual host to work with phpMyAdmin with the command serve:

cd ~/Code
serve phpmyadmin.app /home/vagrant/Code/phpMyAdmin/

Thats it!

Go to http://phpmyadmin.app it should work, and you can login with your user and password homestead default. The great thing about this method is that you can set up your phpmyadmin so long as you keep it in your Homestead.yaml file and phpMyAdmin in your Code directory.

  • I don't know why this is downvoted. This is the correct answer and worked for me. Only thing I would recommend is instead of running the `serve` command, simply run `vagrant provision` since you edited the Homestead.yaml file and open phpmyadmin.app:8000 – leiflundberg Jan 15 '20 at 13:24
-1

adminer index file is located in adminer/adminer so try :

serve adminer.app /home/vagrant/Code/adminer/adminer
Manos Nikolaidis
  • 21,608
  • 12
  • 74
  • 82
Yaroslav Grishajev
  • 2,127
  • 17
  • 22
-1

I installed phpMyAdmin from here

then put these settings in config.inc.php:

/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '33060';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

and opened via Apache (I had a xampp). In my case i placed phpMyAdmin in D:\xampp\htdocs\pma which allowed me to open at localhost/pma url.

Everything worked!