{"id":259,"date":"2019-08-14T09:10:00","date_gmt":"2019-08-14T12:10:00","guid":{"rendered":"http:\/\/xaxowareti.com.br\/?p=259"},"modified":"2019-08-14T09:10:00","modified_gmt":"2019-08-14T12:10:00","slug":"how-to-install-phpmyadmin-with-nginx-on-debian-10","status":"publish","type":"post","link":"https:\/\/xaxowareti.com.br\/?p=259","title":{"rendered":"How To Install phpMyAdmin with Nginx on Debian 10"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.phpmyadmin.net\/\">phpMyAdmin<\/a>&nbsp;is a free and open-source, web-based 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;servers. It is widely used to manage the database by web hosting companies and administrators who are new to the database.<\/p>\n\n\n\n<p>phpMyAdmin helps the system administrator to perform databases activities such as creating, deleting, querying, database, tables, columns, etc.<\/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 Nginx on&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/debian-10\">Debian 10<\/a><strong>.<br><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB Server<\/h3>\n\n\n\n<p>To install phpMyAdmin, your system must have a database instance running and&nbsp;<a href=\"https:\/\/www.itzgeek.com\/tag\/nginx\">Nginx web server<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Standalone Database<\/h4>\n\n\n\n<p>Follow the below tutorials and prepare your system for setting up phpMyAdmin.<\/p>\n\n\n\n<p><strong>Step 1:<\/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<p>Then,<\/p>\n\n\n\n<p><strong>Step 2:<\/strong>&nbsp;<a href=\"https:\/\/www.itzgeek.com\/how-tos\/linux\/debian\/how-to-install-lemp-stack-on-debian-10.html\">How To Install LEMP Stack on Debian 10<\/a>You can skip the database part in Step 2 \u2013 LEMP stack tutorial if you have followed the Step 1 \u2013 MariaDB installation.<\/p>\n\n\n\n<p>Install PHP extensions for phpMyAdmin to connect with database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install -y php-json php-mbstring<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">LEMP Stack<\/h4>\n\n\n\n<p><strong>READ:<\/strong>&nbsp;<a href=\"https:\/\/www.itzgeek.com\/how-tos\/linux\/debian\/how-to-install-lemp-stack-on-debian-10.html\">How To Install LEMP Stack on Debian 10<\/a><\/p>\n\n\n\n<p>Install PHP extensions for phpMyAdmin to connect with database.<\/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>The phpMyAdmin is not available as Deb package in Debian OS repository for Debian 10. So, we will download the tarball from the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.phpmyadmin.net\/downloads\/\" rel=\"noreferrer noopener\">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 phpMyAdmin using the&nbsp;<a href=\"https:\/\/www.itzgeek.com\/how-tos\/linux\/linux-basics-14-tar-command-examples.html\"><code>tar<\/code><\/a>&nbsp;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 to your 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.<\/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 target=\"_blank\" href=\"https:\/\/phpsolved.com\/phpmyadmin-blowfish-secret-generator\/?g=5cecac771c51c\" rel=\"noreferrer noopener\">Generate a blowfish secret<\/a>&nbsp;and update the secret in the configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$cfg['blowfish_secret'] = '<strong>CfX1la\/aG83gx1{7rADus,iqz8RzeV8x<\/strong>'; \/* YOU MUST FILL IN THIS FOR COOKIE AUTH! *\/<\/pre>\n\n\n\n<p>Also, uncomment the phpMyAdmin storage settings.<\/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 target=\"_blank\" href=\"http:\/\/techies-world.com\/phpmyadmin-installation-error-configuration-of-pmadb-not-ok\/\" rel=\"noreferrer noopener\">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 a virtual host configuration file for phpMyAdmin (Ex.&nbsp;phpMyAdmin.conf) under the&nbsp;\/etc\/nginx\/conf.ddirectory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/nginx\/conf.d\/phpMyAdmin.conf<\/pre>\n\n\n\n<p>Use the following information to create a virtual host for phpMyAdmin. Change the domain name (server_name) as per your requirement.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">server {\n   listen 80;\n   server_name <strong>pma.itzgeek.local<\/strong>;\n   root <strong>\/usr\/share\/phpMyAdmin<\/strong>;\n\n   location \/ {\n      index index.php;\n   }\n\n## Images and static content is treated different\n   location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {\n      access_log off;\n      expires 30d;\n   }\n\n   location ~ \/\\.ht {\n      deny all;\n   }\n\n   location ~ \/(libraries|setup\/frames|setup\/libs) {\n      deny all;\n      return 404;\n   }\n\n   location ~ \\.php$ {\n      include \/etc\/nginx\/fastcgi_params;\n      fastcgi_pass 127.0.0.1:9000;\n      fastcgi_index index.php;\n      fastcgi_param SCRIPT_FILENAME <strong>\/usr\/share\/phpMyAdmin<\/strong>$fastcgi_script_name;\n   }\n}\n<\/pre>\n\n\n\n<p>Create a tmp directory for phpMyAdmin and then 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 services.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart nginx \n\nsudo systemctl restart php7.3-fpm<\/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>Access the phpMyAdmin using the browser by going to the below URL.http:\/\/your-fully-qualified-domain-name<\/p>\n\n\n\n<p>Log in with database user we just created in the previous step.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.itzgeek.com\/wp-content\/uploads\/2019\/07\/Install-phpMyAdmin-with-Nginx-on-Debian-10-Login-to-phpMyAdmin.jpg\"><img decoding=\"async\" src=\"https:\/\/www.itzgeek.com\/wp-content\/uploads\/2019\/07\/Install-phpMyAdmin-with-Nginx-on-Debian-10-Login-to-phpMyAdmin-1024x767.jpg\" alt=\"Install phpMyAdmin with Nginx on Debian 10 - Login to phpMyAdmin\" class=\"wp-image-533154\"\/><\/a><figcaption>Install phpMyAdmin with Nginx on Debian 10 \u2013 Login to phpMyAdmin<\/figcaption><\/figure>\n\n\n\n<p>You will get the home page where you can manage databases.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.itzgeek.com\/wp-content\/uploads\/2019\/07\/Install-phpMyAdmin-with-Nginx-on-Debian-10-phpMyAdmin.jpg\"><img decoding=\"async\" src=\"https:\/\/www.itzgeek.com\/wp-content\/uploads\/2019\/07\/Install-phpMyAdmin-with-Nginx-on-Debian-10-phpMyAdmin-1024x662.jpg\" alt=\"Install phpMyAdmin with Nginx on Debian 10 - phpMyAdmin\" class=\"wp-image-533155\"\/><\/a><figcaption>Install phpMyAdmin with Nginx on Debian 10 \u2013 phpMyAdmin<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>phpMyAdmin&nbsp;is a free and open-source, web-based tool for managing the&nbsp;MySQL&nbsp;and&nbsp;MariaDB&nbsp;servers. It is widely used to manage the database by web hosting companies and administrators who are new to the database. phpMyAdmin helps the system administrator to perform databases activities such as creating, deleting, querying, database, tables, columns, etc. In this post, we will see how [&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-259","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\/259","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=259"}],"version-history":[{"count":1,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":260,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/259\/revisions\/260"}],"wp:attachment":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}