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
- How to Install PHPMyAdmin on Debian
- Install PHPMyAdmin on Cloudways
- How to Secure phpMyAdmin by Enabling Authentication
- How to Secure Phpmyadmin by Configuring SSL
- How to Secure By Limiting Access to Specific IP Addresses
- Common Phpmyadmin Installation Issues and Their Possible Solutions
- Wrapping Up!
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
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.
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.
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)
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.
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.
Once done, run the following command to delete the zip.
rm phpMyAdmin-5.2.0-english.zip
Let’s rename the folder so that we can access it easily by running the following command.
mv phpMyAdmin-5.2.0-english phpmyadmin
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.
Now login using the database credentials.
Once you have logged in with your database credentials, you can successfully access the PHPMyAdmin page.
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!
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: Is phpMyAdmin MySQL free?
A: Yes, phpMyAdmin is a free and open-source tool for managing MySQL databases. It provides a user-friendly interface to interact with MySQL databases through a web browser.
Q: Is phpMyAdmin and MySQL the same?
A: No, phpMyAdmin is not the same as MySQL. MySQL is a relational database management system (RDBMS) used for storing and managing data, while phpMyAdmin is a web-based application used as a graphical interface to manage MySQL databases.
Q: How do I open phpMyAdmin in Chrome?
A: Here are the steps to open phpMyAdmin in Chrome:
- Launch your Chrome browser:
- Type the URL of your phpMyAdmin installation into the address bar. The URL format is typically “http://yourdomain.com/phpmyadmin” for remote installations or “http://localhost/phpmyadmin” if accessing it locally.
- Press Enter
- Chrome will now navigate to the phpMyAdmin login page, allowing you to access and manage your MySQL databases through the web interface.
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.
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]