{"id":258,"date":"2019-08-14T09:10:43","date_gmt":"2019-08-14T12:10:43","guid":{"rendered":"http:\/\/xaxowareti.com.br\/?p=258"},"modified":"2019-08-14T09:10:43","modified_gmt":"2019-08-14T12:10:43","slug":"how-to-install-phpmyadmin-with-apache-on-debian-10","status":"publish","type":"post","link":"https:\/\/xaxowareti.com.br\/?p=258","title":{"rendered":"How To Install phpMyAdmin With Apache on Debian 10"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.phpmyadmin.net\/\">phpMyAdmin<\/a>&nbsp;is an open-source, web-based administration tool for managing the&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/mysql\">MySQL<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/mariadb\">MariaDB<\/a>&nbsp;database. It is written in PHP and is one of the most popular database administration tools used by web hosting companies to enable novice system administrators to carry out database activities.<\/p>\n\n\n\n<p>phpMyAdmin helps in performing&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/database\">database<\/a>&nbsp;activities such as creating, deleting, querying, tables, columns, relations, indexes, users, permissions, etc. It is released under GNU GPL v2.<\/p>\n\n\n\n<p>In this post, we will see how to install&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/phpmyadmin\">phpMyAdmin<\/a>&nbsp;with Apache on&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/debian-10\">Debian 10<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install MySQL \/ MariaDB Server<\/h3>\n\n\n\n<p>Before installing phpMyAdmin, install a database instance on your system to connect. You could install it as a standalone database or install as part of the&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/lamp\">LAMP stack<\/a>.<\/p>\n\n\n\n<p>Install the database and then required packages shown below.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Standalone Database<\/h4>\n\n\n\n<p><strong>READ:<\/strong>&nbsp;<a href=\"https:\/\/www.itzgeek.com\/how-tos\/linux\/debian\/how-to-install-mariadb-on-debian-10.html\">How To Install MariaDB on Debian 10<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install -y apache2 apache2-utils php libapache2-mod-php php-pdo php-zip php-json php-common php-fpm php-mbstring php-cli php-mysql<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">LAMP Stack<\/h4>\n\n\n\n<p><strong>READ:<\/strong>&nbsp;<a href=\"https:\/\/www.itzgeek.com\/how-tos\/linux\/debian\/how-to-install-lamp-stack-on-debian-10.html\">How To Install LAMP Stack on Debian 10<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install -y php-json php-mbstring<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Install phpMyAdmin<\/h2>\n\n\n\n<p>phpMyAdmin package is not yet available in Debian repository for Debian 10. So, we need to download the tar package from the&nbsp;<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.phpmyadmin.net\/downloads\/\">official website<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget https:\/\/files.phpmyadmin.net\/phpMyAdmin\/4.9.0.1\/phpMyAdmin-4.9.0.1-all-languages.tar.gz<\/pre>\n\n\n\n<p>Extract the phpMyAdmin tarball using the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tar -zxvf phpMyAdmin-4.9.0.1-all-languages.tar.gz<\/pre>\n\n\n\n<p>Move the phpMyAdmin set up to the desired location.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mv phpMyAdmin-4.9.0.1-all-languages \/usr\/share\/phpMyAdmin<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Configure phpMyAdmin<\/h2>\n\n\n\n<p>Copy the sample configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo cp -pr \/usr\/share\/phpMyAdmin\/config.sample.inc.php \/usr\/share\/phpMyAdmin\/config.inc.php<\/pre>\n\n\n\n<p>Edit the configuration file and add a blowfish secret.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/usr\/share\/phpMyAdmin\/config.inc.php<\/pre>\n\n\n\n<p><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/phpsolved.com\/phpmyadmin-blowfish-secret-generator\/?g=5cecac771c51c\">Generate blowfish secret<\/a>&nbsp;and then place it into the below line.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$cfg['blowfish_secret'] = '<strong>2O:.uw6-8;Oi9R=3W{tO;\/QtZ]4OG:T:<\/strong>'; \/* YOU MUST FILL IN THIS FOR COOKIE AUTH! *\/<\/pre>\n\n\n\n<p>Also, uncomment the phpMyAdmin storage settings shown like below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/**\n * phpMyAdmin configuration storage settings.\n *\/\n\n\/* User used to manipulate with storage *\/\n$cfg['Servers'][$i]['controlhost'] = 'localhost';\n\/\/ $cfg['Servers'][$i]['controlport'] = '';\n$cfg['Servers'][$i]['controluser'] = 'pma';\n$cfg['Servers'][$i]['controlpass'] = 'pmapass';\n\n\/* Storage database and tables *\/\n$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';\n$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';\n$cfg['Servers'][$i]['relation'] = 'pma__relation';\n$cfg['Servers'][$i]['table_info'] = 'pma__table_info';\n$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';\n$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';\n$cfg['Servers'][$i]['column_info'] = 'pma__column_info';\n$cfg['Servers'][$i]['history'] = 'pma__history';\n$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';\n$cfg['Servers'][$i]['tracking'] = 'pma__tracking';\n$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';\n$cfg['Servers'][$i]['recent'] = 'pma__recent';\n$cfg['Servers'][$i]['favorite'] = 'pma__favorite';\n$cfg['Servers'][$i]['users'] = 'pma__users';\n$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';\n$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';\n$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';\n$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';\n$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';\n$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';\n<\/pre>\n\n\n\n<p><strong>Credit:<\/strong>&nbsp;<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"http:\/\/techies-world.com\/phpmyadmin-installation-error-configuration-of-pmadb-not-ok\/\">TECHIES WORLD<\/a><\/p>\n\n\n\n<p>Import the&nbsp;create_tables.sql&nbsp;to create tables for phpMyAdmin.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mysql &lt; \/usr\/share\/phpMyAdmin\/sql\/create_tables.sql -u root -p<\/pre>\n\n\n\n<p>Login to MariaDB.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mysql -u root -p<\/pre>\n\n\n\n<p>Add the user and grant permission to phpMyAdmin\u2019s database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';\n\nFLUSH PRIVILEGES;<\/pre>\n\n\n\n<p>Create an alias in Apache web server to access phpMyAdmin with&nbsp;http:\/\/your-ip-add-dress\/phpmyadmin.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/apache2\/sites-available\/phpmyadmin.conf<\/pre>\n\n\n\n<p>Copy and paste the below content into the above file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Alias \/phpMyAdmin \/usr\/share\/phpMyAdmin\nAlias \/phpmyadmin \/usr\/share\/phpMyAdmin\n\n&lt;Directory \/usr\/share\/phpMyAdmin\/&gt;\n   AddDefaultCharset UTF-8\n\n   &lt;IfModule mod_authz_core.c&gt;\n     # Apache 2.4\n     &lt;RequireAny&gt; \n      Require all granted\n     &lt;\/RequireAny&gt;\n   &lt;\/IfModule&gt;\n   &lt;IfModule !mod_authz_core.c&gt;\n     # Apache 2.2\n     Order Deny,Allow\n     Deny from All\n     Allow from 127.0.0.1\n     Allow from ::1\n   &lt;\/IfModule&gt;\n&lt;\/Directory&gt;\n\n&lt;Directory \/usr\/share\/phpMyAdmin\/setup\/&gt;\n   &lt;IfModule mod_authz_core.c&gt;\n     # Apache 2.4\n     &lt;RequireAny&gt;\n       Require all granted\n     &lt;\/RequireAny&gt;\n   &lt;\/IfModule&gt;\n   &lt;IfModule !mod_authz_core.c&gt;\n     # Apache 2.2\n     Order Deny,Allow\n     Deny from All\n     Allow from 127.0.0.1\n     Allow from ::1\n   &lt;\/IfModule&gt;\n&lt;\/Directory&gt;<\/pre>\n\n\n\n<p>Enable the virtual host with the below command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo a2ensite phpmyadmin<\/pre>\n\n\n\n<p>Create the tmp directory for phpMyAdmin and change the permission.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mkdir \/usr\/share\/phpMyAdmin\/tmp\n\nsudo chmod 777 \/usr\/share\/phpMyAdmin\/tmp<\/pre>\n\n\n\n<p>Set the ownership of phpMyAdmin directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo chown -R www-data:www-data \/usr\/share\/phpMyAdmin<\/pre>\n\n\n\n<p>Restart the Apache web service.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart apache2<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create DB &amp; User<\/h2>\n\n\n\n<p>By default, MariaDB root user is allowed to log in locally via Unix socket. So, we will now create a database user and login to phpMyAdmin with that user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE DATABASE app_db;\n\nGRANT ALL PRIVILEGES ON app_db.* TO 'app_user'@'localhost' IDENTIFIED BY 'password';\n\nFLUSH PRIVILEGES;\n\nEXIT;\n<\/pre>\n\n\n\n<p>If required, you can&nbsp;<a href=\"https:\/\/www.itzgeek.com\/how-tos\/linux\/debian\/how-to-install-mariadb-on-debian-10.html#nativepassword\">disable Unix socket authentication and enable native password login<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Access phpMyAdmin<\/h2>\n\n\n\n<p>Now, access the phpMyAdmin interface using the browser. The URL will be:http:\/\/localhost\/phpMyAdmin<\/p>\n\n\n\n<p><strong>OR<\/strong>http:\/\/your-ip-addr-ess\/phpMyAdmin<\/p>\n\n\n\n<p><strong>Log in with the database user we created in the previous step.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.itzgeek.com\/wp-content\/uploads\/2019\/07\/Install-phpMyAdmin-on-Debian-10-phpMyAdmin-Login-Page.jpg\"><img decoding=\"async\" src=\"https:\/\/www.itzgeek.com\/wp-content\/uploads\/2019\/07\/Install-phpMyAdmin-on-Debian-10-phpMyAdmin-Login-Page-1024x820.jpg\" alt=\"Install phpMyAdmin on Debian 10 - phpMyAdmin Login Page\" class=\"wp-image-533136\"\/><\/a><figcaption>Install phpMyAdmin on Debian 10 \u2013 phpMyAdmin Login Page<\/figcaption><\/figure>\n\n\n\n<p>You will get the below page where you can perform all database activities.<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>phpMyAdmin&nbsp;is an open-source, web-based administration tool for managing the&nbsp;MySQL&nbsp;and&nbsp;MariaDB&nbsp;database. It is written in PHP and is one of the most popular database administration tools used by web hosting companies to enable novice system administrators to carry out database activities. phpMyAdmin helps in performing&nbsp;database&nbsp;activities such as creating, deleting, querying, tables, columns, relations, indexes, users, permissions, etc. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-258","post","type-post","status-publish","format-standard","hentry","category-sem-categoria"],"_links":{"self":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258"}],"version-history":[{"count":1,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":261,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions\/261"}],"wp:attachment":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}