Setup phpMyAdmin with Laravel Valet

This article will show step by step on how to setup phpMyAdmin with Laravel Valet:

  1. Install Homebrew. Execute the following shell command in your terminal:

          
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
          
        

    If you have Homebrew already installed, update it:

          
    brew update
          
        
  2. Install composer. Execute the following shell commands in your terminal:

          
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
          
        

    Reference: Composer Command-line installation

  3. Move/rename the executable composer script to /usr/local/bin/ so that we can execute it anywhere and as plain "composer" (without the .phar):

          
    mv ~/composer.phar /usr/local/bin/composer
          
        
  4. Now lets install Laravel Valet using composer:

          
    composer global require laravel/valet
    valet install
          
        
  5. Install phpMyAdmin using Homebrew. Execute the following shell command in your terminal:

          
    brew install phpmyadmin
          
        
  6. Register phpMyAdmin path with Laravel Valet. Execute the following shell commands in your terminal:

          
    cd /usr/local/share/phpmyadmin
    valet domain test
    valet link
          
        

  7. Now you can access phpMyAdmin in your favorite browser via http://phpmyadmin.test.

Comments

Already had Homebrew, Composer, as well as Valet installed. So to me it was just a matter of following step 5 and 6. Of course, depending on everyone's existing setup, YMMV :)

But thanks so much for sharing this one!

PS: Just a small note: for a fresh Valet installation, the valet domain test command is optional. Out of the box, Valet already proxies all requests to *.test pseudo TLD by using DnsMasq. See the official Valet Docs.

Hi
This seemed very easy... I did 5 & 6 in Terminal (I had everything else installed b4) but when I try to type http://phpmyadmin.test in the browser, I get 404. Any idea?
Paul

The new command to change the tld is valet tld test not valet domain test
Still a great post, I still revisit every time I need to install phpmyadmin for valet!

Really helpful post, thanks.

I'm running Big Sur (11.6) on an M1 Mac, with Homebrew 3.2.15. Some paths are slightly different:

cd /opt/homebrew/share/phpmyadmin
valet tld test
valet link

...then I'm running the Brew mysql package, which defaults to local-only root access without a password. To enable that in phpmyadmin, edit (in the directory above) config.inc.php and change:

$cfg['Servers'][$i]['AllowNoPassword'] = true;

(line 32, as I write). I can now access phpmyadmin.test in my browsers.

Thanks.
Now, I am on this page: http://phpmyadmin.test/
but what are the username and password? I used root and root as username and password but not working.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.