Linux Tactic

Simplify Your Database Management with phpMyAdmin on Debian 9

Installing and Configuring phpMyAdmin on Debian 9

In today’s fast-paced digital world, managing and maintaining a database can be a daunting task. That is why phpMyAdmin is a powerful tool that simplifies this process by allowing users to manage MySQL or MariaDB databases from a web browser.

In this article, you will learn how to install and configure phpMyAdmin on Debian 9.

Installation Steps

To install phpMyAdmin on Debian 9, you will need to follow the steps below. 1.

Open a terminal window and update the repository index by running the following command:

“`

sudo apt-get update

“`

2. Install phpMyAdmin by running the following command:

“`

sudo apt-get install phpmyadmin

“`

3. During the installation process, you will be prompted to choose the web server that you want to use.

Select Apache2 by pressing the spacebar and hit Enter. 4.

Next, you will be asked if you want to use dbconfig-common to automate the database setup. Choose Yes and follow the prompts to finish the installation.

Creating Administrative MySQL User

After installing phpMyAdmin, you need to create an administrative MySQL user to manage the databases. To create an administrative user, follow the steps below.

1. Open the terminal and log in to MySQL or MariaDB by running the following command:

“`

mysql -u root -p

“`

2. At the prompt, enter the MySQL or MariaDB root password.

3. Create a new user by running the following command:

“`

CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’;

“`

Note: Replace “username” with the desired username and “password” with a secure password.

4. Grant the administrative privileges to the user by running the following command:

“`

GRANT ALL PRIVILEGES ON *.* TO ‘username’@’localhost’;

“`

5.

Flush the privileges to update the changes made to the MySQL or MariaDB server.

“`

FLUSH PRIVILEGES;

“`

Accessing phpMyAdmin

Now that you have installed and configured phpMyAdmin on Debian 9, you can access it by typing the following URL in your web browser:

“`

http://localhost/phpmyadmin/

“`

You will be prompted to log in with the administrative user credentials you created earlier. After login, you will see the dashboard with all the databases and tables available on the MySQL or MariaDB server.

Securing phpMyAdmin

After installing and configuring phpMyAdmin, it is essential to secure it to protect your data from unauthorized access. Below are a few steps that you can take to secure phpMyAdmin.

Password Protecting phpMyAdmin Directory

One way to secure the phpMyAdmin directory is to password-protect it. To do so, follow the steps below.

1. Create a new user using the Apache htpasswd utility by running the following command:

“`

sudo htpasswd -c /etc/phpmyadmin/.htpasswd username

“`

Note: Replace “username” with the desired username.

2. You will be prompted to enter and confirm the user’s password.

3. Open the Apache configuration file for phpMyAdmin by running the following command:

“`

sudo nano /etc/phpmyadmin/apache.conf

“`

4.

Add the following lines at the bottom of the file:

“`

AuthType Basic

AuthName “Restricted Files”

AuthUserFile /etc/phpmyadmin/.htpasswd

Require valid-user

“`

5. Save the file and exit.

6. Restart the Apache web server to apply the changes by running the following command:

“`

sudo systemctl restart apache2

“`

Creating and Adding Users to .htpasswd File

You can also create and add users to the .htpasswd file manually by following the steps below. 1.

Create a new user by running the following command:

“`

sudo htpasswd /etc/phpmyadmin/.htpasswd username

“`

Note: Replace “username” with the desired username. 2.

You will be prompted to enter and confirm the user’s password. Configuring Apache to use .htpasswd File

1.

Open the Apache configuration file for phpMyAdmin by running the following command:

“`

sudo nano /etc/phpmyadmin/apache.conf

“`

2. Add the following lines at the bottom of the file:

“`

AuthType Basic

AuthName “Restricted Files”

AuthUserFile /etc/phpmyadmin/.htpasswd

Require valid-user

“`

3.

Save the file and exit. 4.

Restart the Apache web server to apply the changes by running the following command:

“`

sudo systemctl restart apache2

“`

Prerequisites for Installing phpMyAdmin

Before installing phpMyAdmin, you need to have Apache with Let’s Encrypt installed on Debian 9. Below are the steps to install Apache with Let’s Encrypt.

1. Update the repository index by running the following command:

“`

sudo apt-get update

“`

2. Install the Apache web server by running the following command:

“`

sudo apt-get install apache2

“`

3. Install Let’s Encrypt by running the following command:

“`

sudo apt-get install certbot python-certbot-apache

“`

4. Verify the installation of Let’s Encrypt and Apache by running the following command:

“`

sudo certbot –apache

“`

Conclusion

In conclusion, installing and configuring phpMyAdmin on Debian 9 is a simple process that can be done by following the steps mentioned in this article. As an added precaution, securing the phpMyAdmin directory is highly recommended to ensure the safety of your data.

Knowing the prerequisites for installing phpMyAdmin, such as installing Apache with Let’s Encrypt, is vital to ensure a smooth installation process. By following the steps mentioned in this article, you can be confident in your ability to manage and maintain your databases with ease using phpMyAdmin.

3) Updating and Upgrading System Packages on Debian 9

Debian 9 is a stable and reliable operating system that powers servers and computers worldwide. As a responsible system administrator, keeping your system updated and upgraded is an essential security measure.

In this section, we will discuss how to update and upgrade system packages on Debian 9.

Package Index Update

Before updating or upgrading packages, you need to update the package index first. The package index is a database of metadata about the Debian packages that are available from the Debian repositories.

To update the package index, follow the steps below. 1.

Open a terminal window. 2.

Type the following command to update the package index:

“`

sudo apt-get update

“`

3. Hit Enter to execute the command.

This will download the latest package information from the Debian repository.

System Packages Upgrade

After updating the package index, you need to upgrade the system packages to their latest version. Upgrading packages involves downloading and installing new packages to replace outdated versions.

To upgrade the system packages, follow the steps below. 1.

Open a terminal window. 2.

Type the following command to upgrade the system packages:

“`

sudo apt-get upgrade

“`

3. Hit Enter to execute the command.

This will upgrade all currently installed packages to their latest versions. During the upgrade process, you may be prompted to confirm the installation of new packages or changes to existing packages.

You should carefully review these changes and decide whether to accept or reject them. It is recommended that you regularly update and upgrade your system packages to ensure that your system is secure and running the latest software.

4) Installation Completion and Next Steps

After completing the installation of phpMyAdmin on Debian 9, you can start managing your MySQL databases, tables, queries, and operations.

To access the phpMyAdmin dashboard, open your web browser and navigate to the following URL:

“`

http://localhost/phpmyadmin/

“`

You will be prompted to enter your administrative login credentials that you created during the installation process.

Once logged in, you can start creating databases and tables, as well as executing queries and performing operations on them. Be sure to refer to the phpMyAdmin documentation or seek online resources to understand and learn more about specific features and functionalities.

In conclusion, with the steps provided in this article, you can now confidently install and configure phpMyAdmin on Debian 9 and manage your MySQL or MariaDB databases with ease. By following the guidelines on package index updating and system package upgrading, you can ensure that your system is in optimal condition, running the latest packages, and providing you with the best possible experience.

This article discussed how to install and configure phpMyAdmin on Debian 9 as well as updating and upgrading system packages. PhpMyAdmin is a powerful tool for managing MySQL and MariaDB databases through a web browser, and it is essential to maintain security by securing the tool and regularly updating and upgrading system packages.

With the steps provided in this article, users can confidently install and manage their databases with ease. It is important to remember to regularly update and upgrade your system packages to ensure that your system is secure and up-to-date.

By following these guidelines, you can effectively and efficiently manage your databases while maintaining optimal system performance.

Popular Posts