You are here

phpMyAdmin

As a Mac user, my primary client for mysql database management (when I'm not using command-line tools) has been Sequel Pro (formerly Cocoa MySQL). Now that Sequel Pro has been abandoned, I figured I might as well try out PHPMyAdmin, especially considering that's what most web hosting portals use.

This guide assumes you already have a functional apache2/mysql server running.

Installation on my Ubuntu web server via the command line was trivial. First, ensure that all repositories and packages are up-to-date:

$ sudo apt update && apt upgrade -y

Then:

$ sudo apt install phpmyadmin

The installer prompted me to make a few administrative decisions. Choose "No" when prompted for the dbconfig-common option, and choose apache2 at the next prompt. Enter root and your mysql password when prompted for each.

I pointed my browser to http://127.0.0.1/phpmyadmin and was rewarded by the phpmyadmin login screen. Use your mysql credentials here to login. After logging into phpmyadmin for the first time, I noticed a warning that some features were disabled, with a reference to pmadb not ok. Googling this message turned up a very helpful guide. The remainder of this guide is based on this source.

Upon examining the apache2 path, I found a new file /etc/apache2/conf-available/phpmyadmin.conf along with its corresponding symbolic link in /etc/apache2/conf-enabled. Inspecting this file indicated that phpmyadmin had been installed in /usr/share/phpmyadmin.

Following the guide I found, I created the tables necessary for phpmyadmin full functionality.

$ mysql -u root -p < create_tables.sql

Next we need to setup a user and provide the necessary rights. Although I'm not sure how important it is, I changed the password just to add a bit of security. You can do the following from the mysql command line tool, or right from inside phpmyadmin itself.

CREATE USER 'pma'@'localhost' IDENTIFIED BY 'pmapass';
GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO 'pma'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

You'll then need to edit the config.inc.php, or create it if it doesn't exist. My installation provided a file called config.sample.inc.php so I just copied it to config.inc.php. Edit the file and uncomment the following lines, again using the password you set in the previous step.

/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = 'localhost';
// $cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';

As a final security measure, I removed read privileges to config.inc.php so nobody can see the configuration or password I'm using. Logout and back into the phpmyadmin panel, and you should be all set! After completing this procedure, I no longer receive the message about pmadb not ok. The installation even included local documentation via the web interface. I've always been happy with how phpmyadmin works on my shared hosting accounts, so now I run it at home. Likely more information to follow as I dig around and learn more about the inner workings of phpmyadmin

Tags: