Using PhpMyAdmin With Homestead

Laravel Homestead includes a lot of software, but unfortunately does not have PhpMyAdmin.  You can always install it on nginx, but if you have it already on your host system (for example, as a part of xampp package), you can always configure it as a Nginx site.

First of all, you need to edit your config.inc.php file.  At the top of it insert $cfg[‘CheckConfigurationPermissions’] = false;  (PhpMyAdmin does not like when config file has loose permissions).  Next add the following code to the config file  to enable remote server configuration for your homestead database.


$i++;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '192.168.10.10';
$cfg['Servers'][$i]['verbose'] = 'Homestead Database';
$cfg['Servers'][$i]['user'] = 'homestead';
$cfg['Servers'][$i]['password'] = 'secret';
$cfg['Servers'][$i]['hide_db'] = '^(mysql|performance_schema|innodb|information_schema)$';

 

Now go and edit your Homestead.yaml file.  Add the following lines to your folders: section to map location of your PhpMyAdmin file


- map: /xampp/phpMyAdmin
to: /home/vagrant/phpmyadmin

 

In the sites : section add mapping to access your PhpMyAdmin

- map: phpmyadmin.dev
to: /home/vagrant/phpmyadmin

 

After that go to your hosts file (/etc/hosts on Mac or Linux, C:\Windows\System32\drivers\etc\hosts on Windows) and add the following line 192.168.10.10 phpmyadmin.dev
You are all set. Reload your Homestead instance with vagrant reload –provision. After instance is up and running, go to phpmyadmin.dev and select Homestead Database from Current Server dropdown.