Computing: Website and Database Programming

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 (such 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. Web space providers, offering the creation of MySQL databases, nearly always offer phpMyAdmin to manage them.
Note: The phpMyAdmin, that I used, when writing this tutorial, was version 4.7.9. For some considerations, concerning the actual (October 2021) version 5.1.1, cf. Actual phpMyAdmin distribution.
  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. Create a directory called phpMyAdmin in the Apache document root (htdocs) folder (cf. part 1), unzip the archive (in my case actually 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 web 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 every 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 server, 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. But, on Windows this might be complicated and time consuming (?).
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 it 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 (that 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 in fact nothing else than creating/editing a copy of the phpMyAdmin configuration file, located in the /phpMyAdmin/setup directory. Use the Download button in the script's main window to download the phpMyAdmin configuration file and move it to the main phpMyAdmin directory. This is mandatory! If you don't do so, the phpMyAdmin application will not work!
The phpMyAdmin not responding problem.
In the past, I frequently experienced the problem, that the connection to MySQL using phpMyAdmin was extremely slow, or even not responsive. No idea if this was (is) a bug in the application or due to some problem on my system. Simple work-around: Edit your file and set the server host name to the local IP address ( instead of its name (localhost), by changing the original $cfg['Servers'][$i]['host'] = 'localhost'; to:
    $cfg['Servers'][$i]['host'] = '';
  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 3.5).
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
  4.5. Actual phpMyAdmin distribution.
The actual (October 2021) version is phpMyAdmin 5.1.1. Configuration was simple and smooth using the setup script. Nothing left of the problems, that I had with version 5.0.4 (January 2021). And it runs without any problems on my Windows 10 with PHP 8.0.0 on Apache Lounge 2.4.46, administering both my MySQL 8.0 and my MariaDB 10.6 databases.
As an example of a minimalist configuration, here the content of my auto-generated
        /* Servers configuration */
        $i = 0;
        /* Server: MySQL 8.0 [1] */
        $cfg['Servers'][$i]['verbose'] = 'MySQL 8.0';
        $cfg['Servers'][$i]['host'] = '';
        $cfg['Servers'][$i]['port'] = 3306;
        $cfg['Servers'][$i]['socket'] = '';
        $cfg['Servers'][$i]['auth_type'] = 'cookie';
        $cfg['Servers'][$i]['user'] = 'root';
        $cfg['Servers'][$i]['password'] = '';
        /* Server: MariaDB 10.6 [2] */
        $cfg['Servers'][$i]['verbose'] = 'MariaDB 10.6';
        $cfg['Servers'][$i]['host'] = '';
        $cfg['Servers'][$i]['port'] = 3307;
        $cfg['Servers'][$i]['socket'] = '';
        $cfg['Servers'][$i]['auth_type'] = 'cookie';
        $cfg['Servers'][$i]['user'] = 'root';
        $cfg['Servers'][$i]['password'] = '';
        /* End of servers configuration */
        $cfg['blowfish_secret'] = '[BLOWFISH-SECRET]';
        $cfg['DefaultLang'] = 'en';
        $cfg['ServerDefault'] = 1;
        $cfg['UploadDir'] = '';
        $cfg['SaveDir'] = '';

If you find this text helpful, please, support me and this website by signing my guestbook.