{"id":5631,"date":"2020-04-30T00:01:32","date_gmt":"2020-04-29T21:01:32","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5631"},"modified":"2024-03-14T20:03:06","modified_gmt":"2024-03-14T17:03:06","slug":"install-phpmyadmin-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-phpmyadmin-on-ubuntu-20-04\/","title":{"rendered":"Install phpMyAdmin on Ubuntu 20.04"},"content":{"rendered":"\n<p>In this guide, we are going to learn how to install phpMyAdmin on Ubuntu 20.04. <a href=\"https:\/\/www.phpmyadmin.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">phpMyAdmin<\/a> is a free and opensource application written in PHP that<em> <\/em>facilitates the administration and management of MySQL and MariaDB over the Web.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#installing-php-my-admin-on-ubuntu-20-04\">Installing phpMyAdmin on Ubuntu 20.04<\/a><ul><li><a href=\"#what-can-you-use-php-my-admin-for\">What can you use phpMyAdmin for?<\/a><\/li><li><a href=\"#prerequisites\">Prerequisites<\/a><ul><li><a href=\"#install-lamp-stack-on-ubuntu-20-04\">Install LAMP Stack on Ubuntu 20.04<\/a><\/li><\/ul><\/li><li><a href=\"#install-php-my-admin\">Install phpMyAdmin<\/a><ul><li><a href=\"#download-php-my-admin-tarball\">Download phpMyAdmin Tarball<\/a><\/li><li><a href=\"#create-apache-virtual-host-for-php-my-admin\">Create Apache VirtualHost for phpMyAdmin<\/a><\/li><\/ul><\/li><li><a href=\"#configure-php-my-admin-on-ubuntu-20-04\">Configure phpMyAdmin on Ubuntu 20.04<\/a><\/li><li><a href=\"#enable-php-my-admin-general-relation-features\">Enable phpMyAdmin General relation features<\/a><\/li><li><a href=\"#open-http-port-on-firewall\">Open HTTP Port on Firewall<\/a><\/li><li><a href=\"#accessing-php-my-admin-on-ubuntu-20-04\">Accessing phpMyAdmin on Ubuntu 20.04<\/a><\/li><li><a href=\"#related-tutorials\">Related Tutorials<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-php-my-admin-on-ubuntu-20-04\">Installing phpMyAdmin on Ubuntu 20.04<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"what-can-you-use-php-my-admin-for\">What can you use phpMyAdmin for?<\/h3>\n\n\n\n<p>phpMyAdmin allows administrators to;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>browse through databases and tables;<\/li>\n\n\n\n<li>create, copy, rename, alter and drop databases;<\/li>\n\n\n\n<li>create, copy, rename, alter and drop tables;<\/li>\n\n\n\n<li>perform table maintenance;<\/li>\n\n\n\n<li>add, edit and drop fields;<\/li>\n\n\n\n<li>execute any SQL-statement, even multiple queries;<\/li>\n\n\n\n<li>create, alter and drop indexes;<\/li>\n\n\n\n<li>load text files into tables;<\/li>\n\n\n\n<li>create and read dumps of tables or databases;<\/li>\n\n\n\n<li>export data to SQL, CSV, XML, Word, Excel, PDF and LaTeX formats;<\/li>\n\n\n\n<li>administer multiple servers;<\/li>\n\n\n\n<li>manage MySQL users and privileges;<\/li>\n\n\n\n<li>check server settings and runtime information with configuration hints;<\/li>\n\n\n\n<li>check referential integrity in MyISAM tables;<\/li>\n\n\n\n<li>create complex queries using Query-by-example (QBE), automatically<br>connecting required tables;<\/li>\n\n\n\n<li>create PDF graphics of database layout;<\/li>\n\n\n\n<li>search globally in a database or a subset of it;<\/li>\n\n\n\n<li>transform stored data into any format using a set of predefined<br>functions, such as displaying BLOB-data as image or download-link;<\/li>\n\n\n\n<li>manage InnoDB tables and foreign keys;<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h3>\n\n\n\n<p>Since phpMyAdmin is a web based tool for administering MySQL or MariaDB, and is written on PHP, the most <a href=\"https:\/\/docs.phpmyadmin.net\/en\/latest\/require.html\" target=\"_blank\" rel=\"noreferrer noopener\">basic requirement<\/a> that you need is either a LAMP or LEMP Stack. This demo uses the former.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"install-lamp-stack-on-ubuntu-20-04\">Install LAMP Stack on Ubuntu 20.04<\/h4>\n\n\n\n<p>We have describe extensively how to install LAMP stack on Ubuntu 20.04 in our previous guide whose link is provided below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-lamp-stack-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install LAMP Stack on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p>Note, we are using PHP 8 and MySQL 8 in this guide.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<pre class=\"scroll-sz\"><code>\nPHP 8.2.7 (cli) (built: Jun  8 2023 15:27:12) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.2.7, Copyright (c) Zend Technologies\n    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies\n\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -V<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql  Ver 15.1 Distrib 10.3.38-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2<\/code><\/pre>\n\n\n\n<p>Install other required PHP modules for phpMyAdmin;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt install php8.2-{bz2,mbstring,zip,gd,curl,xml,mysqli,common,opcache,imagick}<\/pre>\n\n\n\n<p>See list of requirements on <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.phpmyadmin.net\/en\/latest\/require.html\" target=\"_blank\">phpMyAdmin requirements page<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-php-my-admin\">Install phpMyAdmin<\/h3>\n\n\n\n<p>phpMyAdmin 4.4.9 is available on the default Ubuntu 20.04 repos. However the latest stable release version of phpMyAdmin as of this writing is v5.2.1. Hence, to install the latest version, proceed as follows;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"download-php-my-admin-tarball\">Download phpMyAdmin Tarball<\/h4>\n\n\n\n<p>Navigate to <a rel=\"noreferrer noopener\" href=\"https:\/\/www.phpmyadmin.net\/downloads\/\" target=\"_blank\">phpMyAdmin downloads page<\/a> and grab the source tarball of your preferred language. You can obtain the source tarball link and use wget to pull it. For example, in this guide, we using phpMyAdmin english version. Be sure to replace the version number accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">VER=5.2.1<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">wget https:\/\/files.phpmyadmin.net\/phpMyAdmin\/$VER\/phpMyAdmin-$VER-english.tar.gz<\/pre>\n\n\n\n<p>phpMyAdmin comes bundled as a ready application. By default, phpMyAdmin expects to find its files under <code>\/usr\/share\/phpmyadmin<\/code> directory. As such, we are going to install it on this directory.<\/p>\n\n\n\n<p>Create this prior to extracting phpMyAdmin.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir \/usr\/share\/phpmyadmin<\/pre>\n\n\n\n<p>Extract the source tarball;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tar xzf phpMyAdmin-$VER-english.tar.gz -C \/usr\/share\/phpmyadmin --strip-components=1<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"create-apache-virtual-host-for-php-my-admin\">Create Apache VirtualHost for phpMyAdmin<\/h4>\n\n\n\n<p>Create Apache virtual host configuration file for phpMyAdmin as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vim \/etc\/apache2\/sites-available\/phpmyadmin.conf<\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nAlias \/phpmyadmin \/usr\/share\/phpmyadmin\n\n&lt;Directory \/usr\/share\/phpmyadmin&gt;\n    Options SymLinksIfOwnerMatch\n    DirectoryIndex index.php\n\n    &lt;IfModule mod_php7.c&gt;\n        php_admin_value open_basedir \/usr\/share\/phpmyadmin\/\n    &lt;\/IfModule&gt;\n\n&lt;\/Directory&gt;\n\n&lt;Directory \/usr\/share\/phpmyadmin\/templates&gt;\n    Require all denied\n&lt;\/Directory&gt;\n&lt;Directory \/usr\/share\/phpmyadmin\/libraries&gt;\n    Require all denied\n&lt;\/Directory&gt;\n\n# Enable phpMyAdmin Setup basic Authentication\n&lt;Directory \/usr\/share\/phpmyadmin\/setup&gt;\n    &lt;IfModule mod_authz_core.c&gt;\n        &lt;IfModule mod_authn_file.c&gt;\n            AuthType Basic\n            AuthName \"phpMyAdmin Setup\"\n            AuthUserFile \/usr\/share\/phpmyadmin\/.pma.setup\n        &lt;\/IfModule&gt;\n        Require valid-user\n    &lt;\/IfModule&gt;\n&lt;\/Directory&gt;\n<\/code><\/pre>\n\n\n\n<p>Save and exit the configuration file.<\/p>\n\n\n\n<p>Since we have enabled basic authentication for the setup page, generate username and passwords and store them in the specified auth file. Replace the usernames accordingly;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">htpasswd -c \/usr\/share\/phpmyadmin\/.pma.setup pmaadmin<\/pre>\n\n\n\n<p>Verify Apache configuration syntax;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apachectl -t<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Syntax OK<\/pre>\n\n\n\n<p>Enable phpMyAdmin site;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a2ensite phpmyadmin.conf<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"configure-php-my-admin-on-ubuntu-20-04\">Configure phpMyAdmin on Ubuntu 20.04<\/h3>\n\n\n\n<p>Rename the sample phpMyAdmin configuration file;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cp \/usr\/share\/phpmyadmin\/config{.sample,}.inc.php<\/pre>\n\n\n\n<p>Open the configuration file for modification;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vi \/usr\/share\/phpmyadmin\/config.inc.php<\/pre>\n\n\n\n<p>Create a blowfish secret required for cookie based authentication to encrypt password in cookie. You can generate the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/phpsolved.com\/phpmyadmin-blowfish-secret-generator\/?g=[insert_php]echo%20$code;[\/insert_php]\" target=\"_blank\">blowfish secret online<\/a>&nbsp;and paste as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">...\n\/**\n * This is needed for cookie based authentication to encrypt password in\n * cookie. Needs to be 32 chars long.\n *\/\n<strong>$cfg['blowfish_secret'] = 'f0b6c3a22fd04a454631f9e3b8f3c84f';<\/strong> \/* YOU MUST FILL IN THIS FOR COOKIE AUTH! *\/\n...<\/pre>\n\n\n\n<p>Save and quit the configuration file.<\/p>\n\n\n\n<p>You can use the command below to generate the string!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl rand -hex 16<\/code><\/pre>\n\n\n\n<p>Create phpMyAdmin Temp Directory and update ownership;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/usr\/share\/phpmyadmin\/tmp\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chown -R www-data: \/usr\/share\/phpmyadmin\/tmp<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"enable-php-my-admin-general-relation-features\">Enable phpMyAdmin General relation features<\/h3>\n\n\n\n<p>General relations are required to work with relationships between tables in a relational database;<\/p>\n\n\n\n<p>Create <strong><code>phpmyadmin<\/code><\/strong> database;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqladmin -u root -p create phpmyadmin<\/code><\/pre>\n\n\n\n<p>Create database use for phpMyAdmin database;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p -e \"GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'ChangeME';\"<\/code><\/pre>\n\n\n\n<p>Import the initial structure and data into the phpmyadmin database;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p phpmyadmin &lt; \/usr\/share\/phpmyadmin\/sql\/create_tables.sql<\/code><\/pre>\n\n\n\n<p>next, edit the config, <strong><code>\/usr\/share\/phpmyadmin\/config.inc.php<\/code><\/strong>, and uncomment the lines below and update them;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ $cfg&#91;'Servers']&#91;$i]&#91;'controluser'] = 'pma';\n\/\/ $cfg&#91;'Servers']&#91;$i]&#91;'controlpass'] = 'pmapass';<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/usr\/share\/phpmyadmin\/config.inc.php<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'controluser'] = 'phpmyadmin';\n$cfg&#91;'Servers']&#91;$i]&#91;'controlpass'] = 'ChangeME';<\/code><\/pre>\n\n\n\n<p>Save and exit the file<\/p>\n\n\n\n<p>Restart Apache<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart apache2<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"open-http-port-on-firewall\">Open HTTP Port on Firewall<\/h3>\n\n\n\n<p>Allow Apache on UFW for external access.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ufw allow \"Apache Full\"<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"accessing-php-my-admin-on-ubuntu-20-04\">Accessing phpMyAdmin on Ubuntu 20.04<\/h3>\n\n\n\n<p>You can now access phpMyAdmin from the browser using the address, <code><strong>http:\/\/server-host-name_or_IP\/phpmyadmin<\/strong><\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1111\" height=\"662\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-login-page-debian.png\" alt=\"Install phpMyAdmin on Ubuntu 20.04\" class=\"wp-image-17246\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-login-page-debian.png?v=1686770917 1111w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-login-page-debian-768x458.png?v=1686770917 768w\" sizes=\"(max-width: 1111px) 100vw, 1111px\" \/><\/figure>\n\n\n\n<p>Login using your database root user credentials.<\/p>\n\n\n\n<p>Upon successful login, you get to phpMyAdmin dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1893\" height=\"856\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-ubuntu20.png\" alt=\"\" class=\"wp-image-17252\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-ubuntu20.png?v=1686775642 1893w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-ubuntu20-768x347.png?v=1686775642 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/06\/phpmyadmin-ubuntu20-1536x695.png?v=1686775642 1536w\" sizes=\"(max-width: 1893px) 100vw, 1893px\" \/><\/figure>\n\n\n\n<p>You have successfully installed and setup phpMyAdmin on Ubuntu 20.04. You can now be able to administer your MySQL or MariaDB from web.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"related-tutorials\">Related Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpmyadmin-with-nginx-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install phpMyAdmin with Nginx on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpmyadmin-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install phpMyAdmin on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpmyadmin-with-nginx-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install phpMyAdmin with Nginx on Fedora 30<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpmyadmin-with-apache-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install phpMyAdmin with Apache on Fedora 30<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we are going to learn how to install phpMyAdmin on Ubuntu 20.04. phpMyAdmin is a free and opensource application written in PHP<\/p>\n","protected":false},"author":1,"featured_media":17254,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,299,342,938],"tags":[1519,1521,136,135,281,1518,1200],"class_list":["post-5631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-database","category-php","category-phpmyadmin","tag-install-phpmyadmin-with-mysql-8","tag-latest-phpmyadmin","tag-mariadb","tag-mysql","tag-phpmyadmin","tag-phpmyadmin-ubuntu-20-04","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5631"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=5631"}],"version-history":[{"count":5,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5631\/revisions"}],"predecessor-version":[{"id":21348,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5631\/revisions\/21348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/17254"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=5631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=5631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=5631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}