How To Install and Secure phpMyAdmin on Ubuntu 16.04

How To Install and Secure phpMyAdmin on Ubuntu 16.04

How To Install and Secure phpMyAdmin on Ubuntu 16.04

phpMyAdmin is a free and open source web-based tool for managing MySQL and MariaDB databases. It provides a user-friendly interface to manage databases, tables, and data. In this tutorial, we will walk you through the process of installing and securing phpMyAdmin on Ubuntu 16.04.

Step 1: Update the System

Before we start the installation process, it is important to update the system. Open the terminal and run the following command:

sudo apt-get update sudo apt-get upgrade

Step 2: Install Apache, MySQL, and PHP

phpMyAdmin requires Apache, MySQL, and PHP to be installed on the system. Run the following command to install them:

sudo apt-get install apache2 mysql-server php php-mysql

Step 3: Install phpMyAdmin

Now that we have Apache, MySQL, and PHP installed, we can proceed with the installation of phpMyAdmin. Run the following command:

sudo apt-get install phpmyadmin

During the installation process, you will be prompted to select the web server that you want to configure. Select "Apache2" and press Enter. You will also be prompted to configure the database for phpMyAdmin. Select "Yes" and enter the MySQL root password when prompted.

Step 4: Configure phpMyAdmin

By default, phpMyAdmin is accessible from any IP address. This can be a security risk, especially if the server is publicly accessible. To restrict access to phpMyAdmin, we need to configure Apache.

Open the Apache configuration file:

sudo nano /etc/apache2/apache2.conf

Add the following lines at the end of the file:

Alias /phpmyadmin /usr/share/phpmyadmin Options Indexes FollowSymLinks DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all Require all granted

Save and close the file.

Step 5: Restart Apache

After making changes to the Apache configuration, we need to restart Apache for the changes to take effect:

sudo systemctl restart apache2

Step 6: Test phpMyAdmin

Open your web browser and go to http://localhost/phpmyadmin. You should see the phpMyAdmin login page. Enter your MySQL username and password to log in.

Conclusion

phpMyAdmin is now installed and secured on your Ubuntu 16.04 server. You can now use it to manage your MySQL

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS