Come chat with us and we will get back to you as soon as possible!
Contact SupportHolyHosting
Holy Team

PhpMyAdmin is a free and open-source graphical user interface (GUI) tool used to manage MySQL databases. It can be installed on multiple operating systems using a web server, PHP, and a MySQL database.
If you host your website on a VPS, you will need to install phpMyAdmin on the server manually.
Prerequisites for phpMyAdmin
Before starting, you will need to install the LAMP stack (Linux, Apache, MySQL, PHP) on an Ubuntu VPS. Alternatively, you can use the HolyHosting VPS with a pre-installed OS template.
You will also need to use an SSH client to connect to the server. We have dedicated tutorials for PuTTY (Windows) and Terminal (macOS).
How to Install phpMyAdmin on Ubuntu
The installation of phpMyAdmin on Ubuntu involves five steps. Make sure to execute the commands sequentially.
1. Install the phpMyAdmin Package:
Ubuntu 18.04:
Run the following command to install the phpMyAdmin package and other required PHP modules:
```
sudo apt-get install -y phpmyadmin php-mbstring php-gettext
```
During the installation process, you will need to select a web server. Choose Apache2 by pressing the spacebar.
Now, configure the database. Select Yes.
Then, set a MySQL application password for phpMyAdmin and confirm it.
Ubuntu 20.04:
The steps are quite similar, but you will need to run this command instead:
```
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
```
Like on Ubuntu 18.04, select Apache2 and configure the database with an application password.
Finally, enable the PHP Mbstring extension with this command:
```
sudo phpenmod mbstring
```
Restart the Apache service with this command:
```
sudo systemctl restart apache2
```
2. Configure the User and Grant Permissions:
The default phpMyAdmin account has minimal options. To manage MySQL databases and access all phpMyAdmin features, you need to create a new user with full permissions.
To manage MySQL users, log in to the MySQL command line with this command:
```
sudo mysql -u root -p
```
You will need to enter the MySQL root password before accessing the MySQL shell. Then, grant all privileges to the phpMyAdmin user:
```
GRANT ALL PRIVILEGES ON . TO 'phpmyadmin'@'localhost';
FLUSH PRIVILEGES;
EXIT
```
3. Access phpMyAdmin from a Browser:
When the installation process is complete, open the browser and go to http://tu-direccion-ip-del-servidor/phpmyadmin. Replace your-server-ip-address with the actual IP address of your server.
The phpMyAdmin login page will look like this:

Due to security issues, Ubuntu 18.04 and Ubuntu 20.04 disable the default MySQL root login. You will need to log in using the phpMyAdmin user credentials you set during installation.
4. Create a Separate phpMyAdmin User (Optional):
If you don't want to use or work with the default phpMyAdmin user account, you can create a new one.
You will need to access the MySQL command-line interface using root privileges:
```
sudo mysql -u root -p
```
Enter the MySQL root password when prompted. Then, create a new user account:
```
CREATE USER username IDENTIFIED by 'password';
GRANT ALL PRIVILEGES ON . TO 'username'@'localhost';
FLUSH PRIVILEGES;
EXIT
```
Replace username and password with the desired credentials.
Restart the Apache server if you encounter issues logging in with the new account:
```
sudo systemctl restart apache2
```
We recommend checking the Status tab in the phpMyAdmin control panel to make sure the connection is working properly.
5. Secure phpMyAdmin (Optional):
phpMyAdmin is susceptible to cyberattacks, so you must implement additional security layers. The most effective way is to use the .htaccess Apache file.
To do so, enable the .htaccess file override by modifying the phpMyAdmin configuration file:
```
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
```
Now, add an AllowOverride All line in the <Directory /usr/share/phpmyadmin> section.
It should look like this:
```apache
<Directory /usr/share/phpmyadmin
>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
AllowOverride All
</Directory>
```
Save and exit the file by pressing CTRL+X. Then, press Y and Enter to confirm. Restart Apache with:
```
sudo systemctl restart apache2
```
The next step is to create an .htaccess file in the phpMyAdmin directory:
```
sudo nano /usr/share/phpmyadmin/.htaccess
```
The Nano text editor will open, allowing you to edit the .htaccess file. Add the following lines:
```apache
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
```
Save and exit the file. Since .htaccess specifies that a password file is needed, create it with:
Use this command to create the password file and pass the username:
```
sudo htpasswd -c /etc/phpmyadmin/.htpasswd USERNAME
```
Replace USERNAME with the actual username. The command will prompt you to create a password. Enter your desired password and press Enter to confirm.
You can create an additional username using the same command without the -c flag:
```
sudo htpasswd /etc/phpmyadmin/.htpasswd ADDITIONAL_USERNAME
```
Restart Apache to implement the changes:
```
sudo systemctl restart apache2
```
When you access phpMyAdmin, a new login dialog box will appear before entering the phpMyAdmin login page at http://tu-direccion-ip-del-servidor/phpmyadmin. The login box should look like this:

Enter the username and password you just created. After logging in, you will see the phpMyAdmin login page where you can enter your MySQL credentials.
Conclusion
phpMyAdmin helps you manage MySQL databases and perform maintenance tasks easily from a web browser. In this tutorial, you have learned how to install phpMyAdmin on Ubuntu and secure it.
Don't forget to implement security measures in phpMyAdmin using strong passwords, .htaccess authentication layers, and separate user accounts.
You should now be able to manage databases easily from phpMyAdmin. If you have any questions, leave a comment below.
Come chat with us and we will get back to you as soon as possible!
Contact SupportAll the information has been carefully documented and made available in our most recent YouTube tutorial. You can watch it below.
The SkinRestorer plugin can be very useful if you are looking to use your server in non-premium mode. In this case, when configuring it as "online-mode:f
The PHP.ini file is a configuration file that contains your web server's PHP settings. Although it comes preconfigured, you may need to change the default PHP