phpMyAdmin is a popular web-based tool for managing MySQL and MariaDB databases. It provides an easy-to-use interface for executing SQL queries, managing tables, and handling user permissions. This guide will walk you through installing phpMyAdmin on a Linux-based VPS, such as one hosted with AnonVM.
System Requirements
Ensure your server meets these requirements before installation:
- OS: Ubuntu 20.04 or Debian 10/11
- Web Server: Apache or Nginx
- Database: MySQL or MariaDB
- PHP: Version 7.4 or higher
Step 1: Update Your Server
Start by updating your package list and upgrading any outdated packages:
Step 2: Install PHP and Required Modules
phpMyAdmin requires PHP along with certain extensions. Install them using:
If you are using a different PHP version, adjust accordingly (e.g., php7.4
or php8.1
).
Step 3: Install MySQL or MariaDB
phpMyAdmin works with both MySQL and MariaDB. If you haven’t installed a database yet, you can install MySQL with:
Secure the MySQL installation:
Step 4: Install Apache (Optional)
If you don’t already have a web server installed, install Apache:
Enable Apache to start at boot:
If you’re using Nginx, ensure it is set up to work with PHP (instructions in the next steps).
Step 5: Install phpMyAdmin
- Install phpMyAdmin:
During installation, you’ll be prompted to select a web server to configure phpMyAdmin automatically. If you’re using Apache, select it here by pressing Space
and Enter
. For Nginx, you will manually configure it in a later step.
-
Configure the Database: Choose
Yes
when prompted to allow phpMyAdmin to configure its own database. -
Set Up phpMyAdmin Password: Enter a strong password for the phpMyAdmin user when prompted. This password will be used by phpMyAdmin to access MySQL.
Step 6: Configure Apache or Nginx for phpMyAdmin
For Apache Users:
phpMyAdmin automatically configures itself with Apache if you selected it during installation. You can access phpMyAdmin by going to http://yourdomain.com/phpmyadmin
.
For Nginx Users:
If you’re using Nginx, create a new server block for phpMyAdmin.
- Create a new Nginx configuration file:
- Add the following configuration:
- Enable the phpMyAdmin configuration and restart Nginx:
Step 7: Secure phpMyAdmin (Optional but Recommended)
-
Restrict Access by IP Address: Limit access to phpMyAdmin by allowing only specific IP addresses. Add the following lines to your Nginx or Apache configuration:
For Nginx:
-
Set Up Additional Authentication: Enable a basic HTTP authentication to add a layer of security.
-
Enable HTTPS: Use Let’s Encrypt or another SSL provider to secure your phpMyAdmin installation over HTTPS.
Step 8: Log In to phpMyAdmin
Now that phpMyAdmin is set up, you can log in:
-
Access phpMyAdmin: Open your browser and go to
http://yourdomain.com/phpmyadmin
. -
Log in using your MySQL root credentials or any other MySQL user credentials you have set up.
-
Manage Databases: You should now see the phpMyAdmin dashboard, where you can create databases, run SQL queries, manage user permissions, and perform other database management tasks.
Conclusion
With phpMyAdmin installed on your AnonVM or similar VPS setup, you now have a powerful, web-based tool for managing databases. Remember to secure phpMyAdmin as much as possible by using HTTPS, restricting IP access, and adding authentication if needed. Regularly update phpMyAdmin, PHP, and your database server to maintain security and stability.