Install Phpmyadmin Debian 10 Nginx


Install Phpmyadmin Debian 10 Nginx

What is PhpMyAdmin?

PhpMyAdmin is a web-based administration tool for managing MySQL databases. It is one of the most popular applications in the Apache, Nginx, and Windows server stacks. This guide will show you how to install the latest version of PhpMyAdmin on a Debian 10 server using Nginx as a web server.

Prerequisites

Before proceeding with the installation, you will need to prepare your server for the installation. This guide assumes that you have already installed Debian 10 and Nginx on your server. You will also need to create a new database for phpMyAdmin and additionally, you will need to create a user account for the database. Additionally, you will need to install the php7.3-fpm and the php7.3-zip packages in order to complete the installation.

Install PhpMyAdmin

The first step is to download and install phpMyAdmin. To do so, use the following command:


$ wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz

This command will download the latest version of phpMyAdmin to your server. Once the download is complete, extract the contents of the archive file:


$ tar -xzf phpMyAdmin-4.9.0.1-all-languages.tar.gz

Once the contents have been extracted, you can move them to the web root directory of your server. For an Nginx server, this is usually /var/www/html. You can use the following command to move the files:


$ mv phpMyAdmin-4.9.0.1-all-languages /var/www/html/phpMyAdmin

Move into the phpMyAdmin directory and copy the sample configuration file:


$ cd phpMyAdmin
$ cp config.sample.inc.php config.inc.php

Once the configuration file has been copied, open it in a text editor and replace the default settings with the settings for your database. The configuration file should contain the following values:


$cfg['Servers'][$i]['controluser'] = 'phpmyadmin';
$cfg['Servers'][$i]['controlpass'] = 'password';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['username'] = 'phpmyadmin';
$cfg['Servers'][$i]['password'] = 'password';
$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]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';

Save the configuration file and exit your text editor.

Configure Nginx

The next step is to configure Nginx to serve the phpMyAdmin application. To do so, create a new Nginx server block configuration file in the /etc/nginx/conf.d directory:


$ vim /etc/nginx/conf.d/phpMyAdmin.conf

Then, paste the following configuration into the file and save it:


server {
listen 80;
server_name phpmyadmin.example.com;
root /var/www/html/phpMyAdmin;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Once the configuration file has been saved, test the syntax of the file and then restart Nginx for the changes to take effect:


$ nginx -s reload

Access phpMyAdmin

At this point, you can access the phpMyAdmin application from your web browser. To do so, open your favorite web browser and access the ip or name of the site running phpMyAdmin and you will be presented with the login page. Enter the admin username and password, and you will be logged into the phpMyAdmin interface.

Conclusion

In this guide, we have shown you how to install and configure phpMyAdmin on a Debian 10 server using Nginx as the web server. phpMyAdmin is a great tool for managing and administering MySQL databases from a web interface. We hope you have found this guide to be useful.

FAQs

Q. What version of phpMyAdmin is included in this guide?

A. This guide is for phpMyAdmin version 4.9.0.1.

Q. What do I need in order to install phpMyAdmin on my server?

A. You will need to have a Debian 10 server with Nginx already installed, as well as a database and user account for phpMyAdmin. Additionally, you will need to have the php7.3-fpm and php7.3-zip packages installed.

Q. Where can I find the configuration file?

A. The configuration file should be located in the phpMyAdmin directory. It is called config.inc.php.

Q. How do I access phpMyAdmin after it is installed?

A. Open a web browser and enter the ip or name of the site running phpMyAdmin. You should be presented with the login page and be able to log into phpMyAdmin with the admin username and password.

Thank you for reading this article. We hope it has helped you to understand how to install and configure phpMyAdmin on your Debian 10 server. For more information, please refer to our documentation and other resources.

Leave a Reply

Your email address will not be published. Required fields are marked *