Install phpMyAdmin (5.0.4.) on macOS
220521 – Latest version is 5.2.0
201117
Installing phpMyAdmin is a pretty straightforward process. Just visit the official site, download the latest version, unzip it, and paste the whole folder contents to your target DocumentRoot directory. Finally, you have also to make some more adjustments. Let’s see the steps below.
A. Obtaining and installing the phpMyAdmin
This is the link for the official site:
https://www.phpmyadmin.net/downloads/
Download phpMyAdmin — the .zip English package is a good choice for our case. Then unzip it and move the folder with its contents into the document root level (DocumentRoot), renaming the folder to phpmyadmin.
NB: The default DocumentRoot is defined at the main apache configuration file: httpd.conf. You can see more at the Apache Installation post, here.
In our case the DocumentRoot directory is:
/usr/local/var/www.
And it can also be addressed via Finder:
Now, we can unzip the downloaded .zip file into /usr/local/var/www (the web root) folder and rename it phpmyadmin:
After that, let’s try to connect to it (supposing that the MariaDB root account has been set up correctly and it has a valid password). See here how to install MariaDB and [here] how to set up a root account in a brand new MariaDB database.
We can use your browser with one of the following links:
http://localhost/phpmyadmin
http://localhost/phpmyadmin/index.php
After you have successfully logged in, you can check the installed phpMyAdmin version, as well as that the Apache and php version already installed are Apache 2.4.46 and php 7.4.12 respectively.
However, as you can see, there is a warning that warns you :
The configuration file now needs a secret passphrase (blowfish_secret).
This means that there is one more step to configure our phpMyAdmin installation. This is to create/configure the config.inc.php file.
B. Configuring the phpMyAdmin installation
There are two methods that can be used. Traditionally, users have hand-edited a copy of config.inc.php, but now a wizard-style setup script is provided for those who prefer a graphical installation. Creating a config.inc.php is still a quick way to get started and needed for some advanced features.
Manually creating the config.inc.php file
To manually create the file, simply use your text editor to create the file config.inc.php. However, a better approach is to use the provided sample file config.sample.inc.php. You should find this file inside the main (top-level) phpMyAdmin directory (the one that contains index.php). If no, you should copy it there. Then, make any necessary adjustments, and finally, rename it to config.inc.php.
phpMyAdmin first loads /libraries/config.default.php and then overrides those values with anything found in config.inc.php. If the default value is okay for a particular setting, there is no need to include it in config.inc.php.
The config.sample.inc.php configuration may look like this:
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * phpMyAdmin sample configuration, you can use it as base for * manual configuration. For easier setup you can use setup/ * * All directives are explained in documentation in the doc/ folder * or at <https://docs.phpmyadmin.net/>. * * @package PhpMyAdmin */ declare(strict_types=1); /** * This is needed for cookie based authentication to encrypt password in * cookie. Needs to be 32 chars long. */ $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /** * Servers configuration */ $i = 0; /** * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false; /** * phpMyAdmin configuration storage settings. */ /* User used to manipulate with storage */ // $cfg['Servers'][$i]['controlhost'] = ''; // $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]['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'; /** * End of servers configuration */ /** * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; /** * Whether to display icons or text or both icons and text in table row * action segment. Value can be either of 'icons', 'text' or 'both'. * default = 'both' */ //$cfg['RowActionType'] = 'icons'; /** * Defines whether a user should be displayed a "show all (records)" * button in browse mode or not. * default = false */ //$cfg['ShowAll'] = true; /** * Number of rows displayed when browsing a result set. If the result * set contains more rows, "Previous" and "Next". * Possible values: 25, 50, 100, 250, 500 * default = 25 */ //$cfg['MaxRows'] = 50; /** * Disallow editing of binary fields * valid values are: * false allow editing * 'blob' allow editing except for BLOB fields * 'noblob' disallow editing except for BLOB fields * 'all' disallow editing * default = 'blob' */ //$cfg['ProtectBinary'] = false; /** * Default language to use, if not browser-defined or user-defined * (you find all languages in the locale folder) * uncomment the desired line: * default = 'en' */ //$cfg['DefaultLang'] = 'en'; //$cfg['DefaultLang'] = 'de'; /** * How many columns should be used for table display of a database? * (a value larger than 1 results in some information being hidden) * default = 1 */ //$cfg['PropertiesNumColumns'] = 2; /** * Set to true if you want DB-based query history.If false, this utilizes * JS-routines to display query history (lost by window close) * * This requires configuration storage enabled, see above. * default = false */ //$cfg['QueryHistoryDB'] = true; /** * When using DB-based query history, how many entries should be kept? * default = 25 */ //$cfg['QueryHistoryMax'] = 100; /** * Whether or not to query the user before sending the error report to * the phpMyAdmin team when a JavaScript error occurs * * Available options * ('ask' | 'always' | 'never') * default = 'ask' */ //$cfg['SendErrorReports'] = 'always'; /** * You can find more configuration options in the documentation * in the doc/ folder or at <https://docs.phpmyadmin.net/>. */
In most cases, you shouldn’t make that many changes. However, one of the most important changes is to use a blowfish secret, just for security reasons, and when we are using cookie authentication (‘cookie’ is phpMyAdmin default option). This is exactly what the warning message warned you about before: The configuration file now needs a secret passphrase (blowfish_secret).
A blowfish secret is a string consisting of 32 characters in length. You can use any string of your choice consisting of characters, numbers, and/or some special characters. For instance:
;-RtEQ3Ey8GU0W]hKcpDA/aeC261ulHl
So, locate the line (line nr 18 above):
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
And replace it with :
$cfg['blowfish_secret'] = ';-RtEQ3Ey8GU0W]hKcpDA/aeC261ulHl';
Save the config.sample.inc.php file, renaming it to config.inc.php. Then exit/logout from phpMyAdmin and login again.
Use the GUI phpMyAdmin to configure the config.inc.php file
In order to configure the config.inc.php you can also use the GUI phpMyAdmin, but it might be a little bit confusing for beginners. However, you can open your browser and visit the location where you installed phpMyAdmin, with the /setup suffix:http://localhost/phpMyAdmin/setup.
Make the changes you wish, but please keep in mind that the changes are not automatically saved to the server. So, you need to use the Download button to save them to your computer and then upload them to the server.
See more about configuration directives for the config.inc.php file at: https://docs.phpmyadmin.net/en/latest/config.html#config
Using the Setup script:
https://docs.phpmyadmin.net/en/latest/setup.html#using-the-setup-script
Collations
Another adjustment might be necessary when you face issues with Languages and especially with Connection collation.
NB: A collation is a set of rules for comparing the characters in a character set in MariaDB/MySQL. See more at: https://dev.mysql.com/doc/refman/8.0/en/charset-general.html
The ‘utf8mb4_unicode_ci’ is the default MariaDB value for the Server connection collation as you can see via phpMyAdmin:
However, the pre-installed schemas might have been created with the ‘utf8mb4_general_ci’ collocation:
This is why you might face issues and warnings like:
You can definitely, ignore it. However, you can correct it. You can either correct the default Server connection collocation (from ‘utf8mb4_unicode_ci’ to ‘utf8mb4_general_ci’) or you can just change only the Collation of mysql pre-installed schema (a partial correction).
NB: There is no need to get in trouble trying to adjust the 2 remaining pre-installed schemas: performance_schema and information_schema since they are not real databases. They just contain information about other databases that the MariaDB/MySQL server maintains. Tables in these schemas are actually views. Trying to alter any one of those schemas produces an error (Error #1044 – Access denied for user ‘root’@’localhost’ to database ‘information_schema’).
Changing the default Server connection collocation is not recommended, because can cause sorting issues in the future when you have to deal with some special languages and strange dialects. Besides, ‘utf8mb4_unicode_ci’ is the default collation, proposed for creating any new schema/database.
So, what you can do is just to change the Collation the pre-installed schema mysql:
Click on it, and in the new pane, locate the ‘Operations’ tab on top, and click on it.
Then scroll down and locate the Collation session. Then you can change the collation from‘utf8mb4_general_ci’, to ‘utf8mb4_unicode_ci’ using the selection box:
That’s it!
Thank you for reading!