This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Try the fastest hosting platform with pay-as-you-go pricing & 24/7 expert support! MIGRATE NOW →

How to Install phpMyAdmin on Your Server: A Comprehensive Guide

Updated on July 7, 2023

9 Min Read

Database is essential to any web-based application for saving records and user data.

If you’re a web developer, you’ve probably heard of phpMyAdmin. It’s a powerful and user-friendly web-based interface for managing MySQL databases, and it’s an essential tool for any developer who works with databases regularly.

Developers can easily find and run commands on the terminal to work with MySQL queries. Also, non-tech-savvy individuals who do not want to go into technical details can perform simple database operations using pre-defined MySQL queries.

The platform allows users to perform complex database operations in just a few clicks and write queries with debugging.

In this article, we’ll tell you how to install phpMyAdmin on your server, from start to finish. We’ll cover everything you need to know, including system requirements, installation methods, and configuration options.

Why Should You Consider Installing PHPMyAdmin on Debian

The reasons for choosing an operating system to run PHPMyAdmin may vary depending on individual circumstances and preferences. However, here are some reasons why you might choose to use PHPMyAdmin on Debian over Mac OS or Ubuntu.

Reason Debian Mac OS Ubuntu
Security Strong security features make it a safer choice for managing sensitive data. Has some built-in security features, but it may not be as strong as Debian. Has some built-in security features, but it may not be as robust as Debian.
Stability Well Known for its stability and reliability, which is important for critical applications like database servers. Stable, but may not be as reliable as Debian. Generally stable but may not be as reliable as Debian.
Compatibility If using Debian as your server OS, it may be easier to install and configure PHPMyAdmin on the same system. May require additional steps to install and configure PHPMyAdmin on a separate system. May require additional steps to install and configure PHPMyAdmin on a separate system.
Familiarity If already familiar with Debian, it may be easier to work with PHPMyAdmin on this OS. May require some learning if not familiar with Mac OS. May require some learning if not familiar with Ubuntu.

Nothing as Easy as Deploying PHP Apps on Cloud

With Cloudways, you can have your PHP apps up and running on managed cloud servers in just a few minutes.

How to Install PHPMyAdmin on Debian

Installing phpMyAdmin with Debian on Cloudways is a relatively straightforward process. Here are the steps to follow:

Installation Requirements

  • Server: Debian-based cloud servers on Cloudways
  • Database: MySQL or MariaDB 5.5 or newer
  • Web Browser: Javascript, cookies, and Bootstrap 4.5
  • PHP Version: PHP 8.x

Deploying on a Debian Server

There are not only non-techie people who want a better GUI to handle complex database functions, but developers too need such a kind of platform to save their precious time. That’s why the best platform recommended for handling database jobs is PHPMyAdmin. It’s is an open source GUI which helps in managing MySQL database. Let’s first setup an SSL with Apache, so that our password isn’t sent in plain text form. Type the following command to install an SSL with Apache server.

apt-get install mcrypt

Now, restart your Apache server with the following command.

service apache2 restart

Now, begin PHPMyAdmin installation by typing the following command.

apt-get install phpmyadmin

During PHPMyAdmin installation process, a prompt will open which will ask you about the web server you are using. Select Apache and press the Enter key. After that it will ask about the root user password. Enter the password and press Enter, once again.

PHPMyAdmin will be installed in /usr/share/phpmyadmin. We will create its symlink inside the public_html folder. Type the following commands to route to public_html folder and create a symlink:

cd /var/www/public_html

ln -s /usr/share/phpmyadmin

Now type ‘ls’ to verify whether the symlink has been created or not. Once verified, open this in browser through [server ip address]/phpmyadmin where you’ll see that it is installed. Now, let’s secure it by creating a .htaccess file using vim file inside PHPMyAdmin folder and allow only your server IP to access it.

order allow,deny

allow from <your server ip>

Now, you can easily use PHPMyAdmin and work with databases.

Host PHP Websites with Ease [Starts at $11 Credit]

  • Free Staging
  • Free backup
  • PHP 8.0
  • Unlimited Websites

TRY NOW

But, the next question is how to open PHPMyAdmin on Cloudways managed servers? To do that you need to follow some steps.

Install PHPMyAdmin on Cloudways

You can install PHPMyAdmin on the app you are using or can launch a new PHP stack application.

DO installation

Once you have launched the PHP stack application, follow the following steps in order to install PHPMyAdmin.

Improve Your PHP App Speed by 300%

Cloudways offers you dedicated servers with SSD storage, custom performance, an optimized stack, and more for 300% faster load times.

Step 1: Launch SSH Terminal

Login to Cloudways Platform, launch SSH terminal and login using Master Credentials.

master-credentials

After successful login, head to the application folder where you want to download PHPMyAdmin by using the following command.

cd applications/<folder name>/public_html

Step 2: Downloading And Installing PHPMyAdmin

Now go to the PHPMyAdmin website and copy the download URL of the latest version of PHPMyAdmin (zipped format)

phpMyAdmin-download

Now go to SSH Terminal, type the following command and paste the download URL.

wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-english.zip

Press Enter and let the server download the file.

install-phpMyAdmin

Once the file has been downloaded,  run the following command to unzip it.

unzip phpMyAdmin-5.2.0-english.zip

Wait for the command to finish its process.

unzip-phpMyAdmin

Once done, run the following command to delete the zip.

rm phpMyAdmin-5.2.0-english.zip

rename-phpMyAdmin

Let’s rename the folder so that we can access it easily by running the following command.

mv phpMyAdmin-5.2.0-english phpmyadmin

remove-phpMyAdmin-zip

Note: Go here to learn more about useful SSH commands .

Now head to the application URL and add /PHPMyAdmin at the end of the URL. You will see that PHPMyAdmin has been installed and you will see its login page.

welcome-phpMyAdmin

Now login using the database credentials.

mysql-access

Once you have logged in with your database credentials, you can successfully access the PHPMyAdmin page.

phpMyAdmin-dashboard

You have successfully installed PHPMyAdmin. You can use it to access all your applications’ databases on the server on which it is installed. And when combined with the excellence of PHP web hosting, your database management experience reaches a whole new level of efficiency and convenience.

Supercharged Managed PHP Hosting – Improve Your PHP App Speed by 300%

How to Secure phpMyAdmin by Enabling Authentication

To secure phpMyAdmin, one way is to enable authentication, which requires users to enter a valid username and password to access the application.

Here’s how to enable authentication in phpMyAdmin:

  • Create a new user account in MySQL with limited permissions. This account will be used to access PhpMyAdmin.
  • You can use the following command to create a user account named “pmauser” with the password “pmapass” and limited privileges:
CREATE USER 'pmauser'@'localhost' IDENTIFIED BY 'pmapass';
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'pmauser'@'localhost';
FLUSH PRIVILEGES;
  • This will create a new user account named “pmauser” with the password “pmapass” and limited privileges to access all databases.
  • Open the PhpMyAdmin configuration file called “config.inc.php” which is located in the root directory of PhpMyAdmin.
  • Search for the line that starts with “$cfg[‘Servers’][$i][‘auth_type’]“. By default, this line is set to “cookie” which means that PhpMyAdmin uses cookies to authenticate users.
  • Change the value of “auth_type” from “cookie” to “http” to enable HTTP authentication. This will prompt users to enter a valid username and password to access PhpMyAdmin.
$cfg['Servers'][$i]['auth_type'] = 'http';
  • Save the changes to the configuration file and exit.
  • Restart the webserver to apply the changes.

How to Secure Phpmyadmin by Configuring SSL

SSL encrypts the data to prevent it from being intercepted by unauthorized parties. Here are the steps to configure SSL for phpMyAdmin:

  • Obtain an SSL certificate from a trusted certificate authority. There are many certificate authorities that offer SSL certificates, such as Comodo, Let’s Encrypt and VeriSign.
  • Install the SSL certificate on the web server. The steps to install an SSL certificate may vary depending on your web server software.
  • Configure the webserver to use SSL for phpMyAdmin. If you are using an Apache web server, open the configuration file called “httpd.conf” and add the following lines:
<VirtualHost *:443>
   SSLEngine On
   SSLCertificateFile /path/to/ssl/certificate.crt
   SSLCertificateKeyFile /path/to/ssl/private.key

   DocumentRoot /path/to/phpmyadmin
   <Directory /path/to/phpmyadmin>
       Options FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>
  • This configuration file sets up a virtual host that listens on port 443, enables SSL encryption, and specifies the SSL certificate and private key file paths.
  • Replace “/path/to/ssl/certificate.crt” and “/path/to/ssl/private.key” with the actual file paths of your SSL certificate and private key.
  • Restart the webserver to apply the changes.

How to Secure By Limiting Access to Specific IP Addresses

By restricting access to a specific IP address or range of IP addresses, you can control who can access phpMyAdmin and protect it from unauthorized access. Here are the steps to limit access to specific IP addresses:

  • Open the configuration file of your web server that hosts phpMyAdmin. The configuration file is typically located at /etc/httpd/conf/httpd.conf.
  • Find the location where phpMyAdmin is hosted. This could be a directory such as “/usr/share/phpmyadmin” or a virtual host configuration.
  • Add the following lines to restrict access to a specific IP address or range of IP addresses:
<Directory /path/to/phpmyadmin>
    Order deny,allow
    Deny from all
    Allow from 192.168.1.10
</Directory>
  • Replace “/path/to/phpmyadmin” with the actual path to the directory where phpMyAdmin is hosted.
  • Replace “192.168.1.10” with the IP address or range of IP addresses that you want to allow access to.
Allow from 192.168.1.0/24
  • This allows access from all IP addresses in the range 192.168.1.0 to 192.168.1.255.
  • Save the configuration file and restart the webserver to apply the changes.

Common Phpmyadmin Installation Issues and Their Possible Solutions

Session Error

“Cannot start session without errors; please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.”

Possible Solution

This error usually occurs due to an incorrect prompt set for the session directory in PHP. To fix this, you can change the permissions of the session directory to 0777 or 0775 (depending on your server configuration) using the following command:

chmod -R 0777 /var/lib/php/sessions/

Mysqli Extension Is Missing Error

The mysqli extension is missing. Please check your PHP configuration.

Possible Solution

This error occurs when the mysqli extension is not installed or enabled on your server. To fix this, you need to install and enable the mysqli extension. You can do this by running the following command:

sudo apt-get install php-mysqli

After installing the extension, you need to restart your web server to enable it.

Connection Error

Cannot connect: invalid settings

Possible Solution

This error usually occurs due to incorrect login credentials or configuration settings. To fix this, you should check the following:

  • Make sure that the host name, username, and password are correct.
  • Make sure that the MySQL server is running and accepting connections.
  • Make sure that the port number and socket path are correct.
  • Check the config.inc.php file for any errors or typos in the configuration settings.

Server Not Found Error

The requested URL /phpmyadmin was not found on this server.

Possible Solution

This error occurs when the phpMyAdmin directory is not installed or configured properly. To fix this, you can try the following:

  • Check if the phpMyAdmin directory exists in the correct location on your server.
  • Check if the Apache web server is configured to serve the phpMyAdmin directory. You can do this by editing the Apache configuration file (httpd.conf) and adding the following lines:
Alias /phpmyadmin "/usr/share/phpmyadmin/"
<Directory "/usr/share/phpmyadmin/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
</Directory>
  • >Restart the Apache web server to apply the changes.

Wrapping Up!

In conclusion, installing phpMyAdmin on Cloudways is a simple process that can be completed in just a few steps. With phpMyAdmin, managing your databases becomes much easier, allowing you to perform a wide range of database operations with just a few clicks.

Following the steps outlined in this tutorial, you can quickly install phpMyAdmin on your Cloudways server and manage your databases more efficiently comes even more streamlined and potent.

Whether you’re a developer or a website owner, having a tool like phpMyAdmin at your disposal can be incredibly useful, so don’t hesitate to give it a try!

Frequently Asked Questions

Q: How to use PHPMyAdmin after installation?

A: Once phpMyAdmin installation is completed, visit your staging app link to access it. For example, http://phpstack-123.cloudwaysapps.com/phpmyadmin.

Q: How to find the port for PHPMyAdmin?

A: On the PHPMyAdmin home screen, click on Home, and move to the Variables option available on the top. Search for port settings, the values are available there.

Q: How to start/install the phpMyAdmin from the command line on Ubuntu?

A: Access the terminal window on your Ubuntu server. Issue the command sudo apt-get install phpmyadmin php-mbstring php-gettext -y. Type in your sudo password when prompted, and then allow the installation to complete.

Q: How to start phpMyAdmin on a Linux-based System?

A: To start the phpMyAdmin, type in the URL: http://{your-ip-address}/phpmyadmin/index.php and login using the MySQL root/admin username and password.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Shahzeb Ahmed

Shahzeb is a Digital Marketer with a Software Engineering background, works as a Community Manager — PHP Community at Cloudways. He is growth ambitious and aims to learn & share information about PHP & Laravel Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now