phpMyAdmin is an indispensable tool when it comes to database management and manipulation. However, it is not perfect out of the box for many advanced users, who would like to customize it a little, and if possible improve workflow and performance of this incredible tool.
phpMyAdmin: HOW TO HIDE SIDEBAR NAVIGATION PANEL
Sidebar navigation is useful for quickly switching through different databases and tables, phpMyAdmin documentation when you need some help, but it can also be very disturbing on smaller screens when you’re working on the go from remote locations, using laptops, tablets or mobile phones. There are 2 different methods we will demonstrate.
METHOD #1: Using theme’s CSS (Cascading Style Sheet)
By default, all modern versions of phpMyAdmin use pmahomme theme with CSS file with appended .php extension located in:
/phpMyAdmin install directory/themes/pmahomme/navigation.css.php
Open this file with code editor of your choice and add new CSS rule for #pma_navigation div:
display: none !important;
Alternatively, you can simply set the programmatic width and instead of:
width: <?php echo $GLOBALS[‘cfg’][‘NaviWidth’]; ?>px;
This is only 1/3rd of the job, however. Next step is to open another CSS file from the same directory as the above one:
/phpMyAdmin install directory/themes/pmahomme/common.css.php
and around line #35 set margin from 240px to 0:
margin-<?php echo $left; ?>: 240px;
margin-<?php echo $left; ?>: 0;
Final step (this is entirely optional, but it will not look 100% right without it) is to edit jquery function inside navigation.js file, which is responsible for dynamic resizing of the top floating_menubar:
/phpMyAdmin install directory/js/navigation.js
Since this is a compressed (minimal) version, everything is a single-line of code. You need to search for a phrase floating_menubar and next to it you will find a function responsible for adding margin-left to the top menu bar. Replace variable f with constant number 0 (zero):
Advantage of the CSS method is that this change is permanent (untill you update phpMyAdmin installation, that is). Even when you log-out and log-in, or restart browser (session), the change will be there and navigation panel will be gone.
Disadvantage of this method is that it will completely hide sidebar navigation panel and the expand/collapse arrow button at the top-left corner, so in case you ever need the panel back for any reason, you will not be able to do it directly, until you fire-up dev console and restore CSS rules.
METHOD #2: Hide navigation panel via directive inside CONFIG.INC.PHP file
NOTE: In newer versions of phpMyAdmin this modification is not necessary since it already works like this.
All important configuration parameters, including user customization, is stored and defined in:
/phpMyAdmin install directory/config.inc.php
Open this file with code editor of your choice and add new rule near the end before final closing ?> php tag:
/* custom mod: auto-hide sidebar navigation panel */
$cfg[‘Servers’][$i][‘NaviWidth’] = ‘5’; // if set to 0 panel will not be able to expand/hide back when clicking <- or -> button @ top
From our tests, if you set value 0, it will, of course, hide the navigation panel, however, you will not be able to restore it once you click the top corner control button. Best value to use is some small positive number 5-10 (does not make any difference, really).
And the end result will look like this (notice that there is no more sidebar displayed on the left):
Advantage of this cool “hack” is that you will be able to restore the sidebar at any time, when you need it!
Disadvantage of this method is that it is not permanent. How long will this magic last? First, it will not be activated by default. Second, it will work only during your session with phpMyAdmin until you log-out and restart browser. What does that mean? When you restart your browser and log-in into phpMyAdmin, you will see the sidebar panel restored again (by default). However, once you hide it by pressing the top-left corner arrow button, it will disappear and not come back during that session, unlike when without this modification sidebar always returns on each page refresh.
phpMyAdmin: HOW TO IMPROVE PERFORMANCE AND DISPLAY MORE ROWS BY DEFAULT
Another annoying thing in phpMyAdmin is the fact that it feels slow. Period. If you ever worked with mysql terminal, or used some alternatives such as Adminer or phpMiniAdmin (notice the subtle name difference here), you will know that phpMyAdmin is slow. End of discussion, thank you very much!
Now, to improve things a little we can define new directives to disable correcting InnoDB estimates
and trying to count number of rows during the View generation. To do this, simply add new lines in config.inc.php file:
/* custom mod: performance */
$cfg[‘MaxExactCount’] = 0; // disable correcting InnoDB estimates
$cfg[‘MaxExactCountViews’] = 0; // disable trying to count number of rows in any view
This will noticeably speed up tables drawing and reduce waiting/idle times.
Another very useful modification is to increase default number of rows being drawn each time you open a large table. By default, this value is 100, very easy and fast to draw, but very inefficient if you need to browse through endless pagination. To increase this to a reasonable number like 1000 (or whatever you need/like) add another line of code:
/* custom mod: set default max database rows */
$cfg[‘MaxRows’] = 1000;
Finally, with few easy tricks you will customize phpMyAdmin to work more for you, instead the other way around ;)