I really like Local by Flywheel as my go-to PHP development environment (Especially, WordPress). But, the default MySQL content management system (Adminer ↱) is not my favorite 😐. I wanted to use PHPMyAdmin ↱ with Local by Flywheel ↱ just like you 😄 for some reason. I would like to know why do you need to switch from Adminer to PHPMyAdmin.
There are few methods to use PHPMyAdmin with Local. I found that this method is the easiest and beginner-friendly method without editing a bunch of Local files. To add PHPMyAdmin to Local follow these really simple steps. It is same as creating a new WordPress instance using Local.
1. Setup a new site on Local
Setup a new website using Local by Flywheel options and call it however you want. (
phpmyadmin.tld would be great). Then, select your environment and setup your WordPress website.
2. Download and Install PHPMyAdmin
First of all, you should clear the
public folder of the recently created website. Yes, remove everything in the
public folder. Then, head over to phpmyadmin.net ↱ and download latest PHPMyAdmin archive. Now, extract the downloaded file into your public folder. Simple stuff 🙂
Almost done! Check your configured domain (phpmyadmin.tld) and you should see the PHPMyAdmin login screen. You can use the database username and password to login to your database. but, wait! this is not the database you wanted to open. Right? Yes, by default PHPMyAdmin accessing the database of its own virtual server. This is not an issue with PHPMyAdmin. This is how Local by Flywheel works. It literally opens/reserves a new port for each website/database you create. The simplest solution that came into my mind is adding the server select box to the PHPMyAdmin login screen. So, I can easily select between different ports (or you can say servers).
3. Configure PHPMyAdmin to Select Specific Ports
Go back to your
public folder of the PHPMyAdmin installation. Find the file called
config.inc.php. If you don’t find the exact file, just rename the
Open your Local by Flywheel dashboard and find select the website that you need to connect with PHPMyAdmin. Then, select the Database tab and there you will see the reserved port number for the MySQL database.
config.inc.php from your favorite code editor and just underneath the first server configuration, add the following code. Make sure to replace your port number which you found on the previous step and preferred name (verbose).
* Second server
$cfg['Servers'][$i]['verbose'] = 'Dev 1';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '10004';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
That’s it! You can repeat step 3 to add more servers. Kind of a silly solution but it works. Let me know if you have any questions.