If you are running Ubuntu, or other Debian based Linux distributions, the easiest way to install phpMyAdmin is to use apt-get:
sudo apt-get install phpMyAdmin
PhpMyAdmin has a very useful feature called query history, that saves all queries that you execute in a table, for later use. This comes in very handy when you write complex queries, then you export the data or switch between multiple tables, only to later realize that your have lost the query (I know, you saved it in the clipboard, but it probably got lost when you copied that file earlier).
Trouble is that, straight out after the installation, this feature is disabled, and I had some trouble finding out how to enable it. The most important requirements are the creation of the phpmyadmin database and the configuration of the phpMyAdmin control user, but these are both done by the installation script, so no worries here.
Here is why it does not work: in a pretty well hidden file somewhere, there is a default value that disables this functionality, so we’ll need to change this. If you’ve installed phpMyAdmin by means of apt-get, you will find this file under:
In this file you need to set:
$cfg['QueryHistoryDB'] = true; $cfg['QueryHistoryMax'] = 1000; //or some other value you find fit
Alternatively, you could add these rows in the config file under /etc/phpmyadmin/config.inc.php. Simply save the file, and all queries will start to be saved!
If you like this feature, you should also check out query bookmarks in phpMyAdmin.