Computing: Website and Database Applications

Web/DB Home   Home   Contact

Web development environment setup on MS Windows.


4. phpMyAdmin.
  4.1. Web based management of MySQL databases.
   
"phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. Frequently used operations (managing databases, tables, columns, relations, indexes, users, permissions, etc) can be performed via the user interface, while you still have the ability to directly execute any SQL statement."
The paragraph above is how the MySQL management tool phpMyAdmin is described on the phpMyAdmin team's website. The phpMyAdmin document on my site explains how to install phpMyAdmin on MS Windows and how to use it. (As it is a web application, installation on Linux is quite the same). phpMyAdmin is a series of PHP scripts running on the web; thus, a webserver, like Apache and the scripting language PHP (and the database server MySQL of course) have to be installed first (cf. parts 1-3).
If you already have a database management application (as MySQL Workbench) installed, you do not need phpMyAdmin. I use both workbench and phpMyAdmin, some features being simpler or giving more possibilities with the one or the other. Webspace providers, offering the creation of MySQL databases, nearly always offer phpMyAdmin to manage them.
  4.2. Installing phpMyAdmin.
   
Installing isn't the correct word, as PHP is distributed as a .zip file, containing the entire directory structure of the application. In your Apache document root folder (cf. part 1), create a directory called "phpMyAdmin", unzip the archieve (in my case actually "phpMyAdmin-4.7.9-all-languages.zip") and move the application's files and folders to this directory. Here, how this should look like:
The phpMyAdmin directory structure
  4.3. Basic phpMyAdmin configuration.
   
The basic configuration of the phpMyAdmin application may be done by a web script, located in the "phpMyAdmin/setup" folder. Type localhost/phpmyadmin/setup/ in your browser's address field to run it.
phpMyAdmin setup (error message)
An error and a warning are shown in the screenshot above: nothing to worry about. Bzip2 compression is part of any Unix system, but is normally absent on Windows. Compression/decompression using this format will simply not be available (and isn't really needed). The "insecure connection" warning is due to the fact that the connection is done using the "http" and not the encrypted "https" protocol. On an Internet, as well as on an intranet server this is NO option, as critical data may be intercepted and viewed by anyone. In my case, with Apache exclusively listening to port 80 on localhost (cf. part 1), the warning may safely be ignored. There is an alternative: installing SSL and then being able to connect using https.
Adding the MySQL server.
Click the "New server" button in the main window of the setup script. Lots of things may be configured here; I never took the time to look at the details, just entering the essential settings (letting all the rest as is set by default).
In the basic settings pane: You may set a user-friendly verbose name for the server (I called it "MySQL 5.7"). The default server hostname is "localhost" (is what it actually is), all other fields may be let blank = default values: port and socket = MySQL default values, no SSL to connect, no compression either.
phpMyAdmin setup (basic settings)
In the authentication pane: Authentication type = "cookie" is alright, using "root" as user for config auth, also; all other fields may be left blank.
phpMyAdmin setup (authentication)
In the server configuration pane (no screenshot): "Allow root login" should be checked by default; I let all other fields blank in this pane, as well as in the 2 last ones ("configuration storage" and "changes tracking", with automatic tracking being disabled).
Pushing the "Apply" button in the main window of the setup script should now list the newly added MySQL server as in the following screenshot:
phpMyAdmin setup (new server created)
Running the setup script is nothing else than creating/editing a copy of the phpMyAdmin configuration file config.inc.php, located in the /phpMyAdmin/setup directory. Use the "Download" button in the script's main window to download this file and move it to the main phpMyAdmin directory. This is mandatory! If you don't do so, the phpMyAdmin application will not work correctly!
The phpMyAdmin "not responding" problem.
I frequently experienced the problem, that the connection to MySQL using phpMyAdmin was extremely slow, or even not responsive. No idea if this ia a bug in the application or due to some problem on my system. Simple work-around: Edit your "config.inc.php" file and set the server host name to the 'local IP address' (127.1.1.0) instead of its name (localhost), by changing the original "$cfg['Servers'][$i]['host'] = 'localhost';" to:
    $cfg['Servers'][$i]['host'] = '127.0.0.1';
  4.4. Running phpMyAdmin.
   
To use phpMyAdmin do manage a MySQL database, type localhost/phpMyAdmin/ in your browser's address field. As login user to MySQL, you may use "root" or any other MySQL user you created (cf. part 1.3).
phpMyAdmin: MySQL login   phpMyAdmin: Home page
And finally, running the SQL query we used in MySQL workbench and in the PHP test script (cf. part 3), using phpMyAdmin: displaying the number of cities in the "city" table of the "world" database.
phpMyAdmin: Running a query