How To Install and Secure phpMyAdmin on Ubuntu 14.04

How To Install and Secure phpMyAdmin on Ubuntu 14.04

How To Install and Secure phpMyAdmin on Ubuntu 14.04

phpMyAdmin is a web-based tool that allows you to manage MySQL databases. It provides an easy-to-use interface for creating, editing, and deleting databases, tables, and records. In this tutorial, you will learn how to install and secure phpMyAdmin on Ubuntu 14.04.

Step 1: Install phpMyAdmin

To install phpMyAdmin, open your terminal and type the following command:

sudo apt-get install phpmyadmin

During the installation process, you will be asked to select the web server that should be automatically configured to run phpMyAdmin. Select "apache2" and press enter.

Next, you will be prompted to enter a password for the phpMyAdmin administrative user. Choose a strong password and remember it.

Step 2: Configure phpMyAdmin

By default, phpMyAdmin is accessible from any IP address. This is a security risk, as anyone can access your database. To secure phpMyAdmin, we need to configure it to only allow connections from certain IP addresses.

Open the phpMyAdmin configuration file in your text editor:

sudo nano /etc/phpmyadmin/config.inc.php

Add the following lines at the end of the file:

	$cfg['Servers'][$i]['auth_type'] = 'cookie';
	$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
	$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
	    'deny from all',
	    'allow from 127.0.0.1',
	    'allow from ::1',
	    'allow from localhost'
	);
	

These lines configure phpMyAdmin to only allow connections from localhost (127.0.0.1 and ::1) and deny all other connections.

Save the file and exit your text editor.

Step 3: Restart Apache

After configuring phpMyAdmin, you need to restart Apache to apply the changes:

sudo service apache2 restart

Now you can access phpMyAdmin by navigating to "http://localhost/phpmyadmin" in your web browser. Enter your phpMyAdmin administrative username and password to log in.

Conclusion

Congratulations! You have successfully installed and secured phpMyAdmin on Ubuntu 14.04. By configuring phpMyAdmin to only allow connections from trusted IP addresses, you have significantly reduced the risk of unauthorized access to your database.

Keywords: phpMyAdmin, Ubuntu 14.04, install, secure, tutorial, MySQL, web-based tool, database management, apache2, configuration, IP addresses, password.

Комментарии

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

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