Managing databases can sometimes feel like a daunting task, but with the right tools, it becomes a breeze. One such tool is Adminer, a lightweight and user-friendly database management tool that supports a variety of database systems like MySQL, PostgreSQL, SQLite, and more. Unlike its bulkier counterparts, Adminer is incredibly easy to set up and navigate, making it an excellent choice for both beginners and seasoned developers. In this guide, we’ll walk you through the steps to install Adminer, so you can streamline your database administration tasks and focus on what really matters – building great applications.
To start, make sure you’ve created a VPSie account if you haven’t already. Next, proceed by deploying an Debian 12 server configured to meet your specific needs.
Once the server is deployed, SSH into the command line interface. Before installing any packages, it’s essential to update your system’s package list to ensure you have access to the latest versions. Open a terminal and run the following command:
sudo apt-get update -y
Install MariaDB
First, update your package index to ensure you have the latest information. Then, install the MariaDB server package using the following command:
sudo apt install mariadb-server
Once the installation is complete, start the MariaDB service using systemd:
sudo systemctl start mariadb
Enable MariaDB to start on boot so it automatically starts after a system reboot:
sudo systemctl enable mariadb
To verify that MariaDB has started successfully and is running, check its status:
sudo systemctl status mariadb
Install Adminer
Adminer is an alternative to phpMyAdmin that also supports PostgreSQL databases. Written in PHP, Adminer can run on nearly any OS with an Apache or Nginx web server. On Debian, the adminer package is available by default and can be easily installed from the repository. To find the adminer package in the default Debian repository, use the following command:
sudo apt info adminer
To install Adminer, run the following command. This will also automatically install the necessary packages, including PHP and Apache.
When prompted, type ‘y‘ to confirm the installation:
sudo apt install adminer
Once the installation is complete, verify that the Apache service is running with this command:
sudo systemctl status apache2
Configure Adminer
Adminer generates new Apache configuration files at /etc/apache2/conf-available/adminer.conf. You will modify this file to set up Adminer. Before editing the file, run the following command to create a password file at /etc/adminer/.htpasswd. Replace dbmanager with your username. This file will provide extra security for Adminer using Apache’s basic_auth module.
sudo htpasswd -B -c /etc/adminer/.htpasswd dbmanager
Now, open the Apache configuration file for Adminer using Nano editor:
sudo nano /etc/apache2/conf-available/adminer.conf
At the top, change the URL from /adminer to your new path. For example, to make Adminer accessible at /dbmanager, update the file like this:
Alias /dbmanager /etc/adminer
Require all granted
DirectoryIndex conf.php
Add the following lines to enable extra security for the /dbmanager path, requiring a password to access it:
AuthType Basic
AuthName "Restricted Resource"
AuthBasicProvider file
AuthUserFile /etc/adminer/.htpasswd
Require valid-user
Save and close the file.
Next, run these commands to activate the new Adminer configuration and check Apache’s syntax:
sudo a2enconf adminer.conf
sudo apachectl configtest
Finally, restart the Apache service to apply the changes:
sudo systemctl restart apache2
Your Adminer installation should now be ready.
Install and Configure MySQL/MariaDB
Prepare your MariaDB server by creating a new user that is specified for Adminer login.
Note: If you’re connecting through a remote host, make sure you’re via SSH tunneling to encrypt your connection.
Log in to the MySQL/MariaDB server with the command below.
sudo mysql -u root -p
Run the following queries to create a new user dbmanager for your MySQL server:
CREATE USER 'dbmanager'@'127.0.0.1' IDENTIFIED BY 'dbpassword';
GRANT ALL PRIVILEGES ON *.* TO 'dbmanager'@'127.0.0.1' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Now, run the following query to verify the list user in your MySQL server:
SELECT user,host FROM mysql.user;
Access MySQL Server via Adminer
To begin, open your web browser and navigate to http://<server-ip>/dbmanager, where you’ll enter the username and password you previously set up. After inputting your credentials, click on Sign In.
By following these straightforward steps, you’ve successfully installed Adminer on your Debian 12 system. Adminer provides a lightweight yet powerful interface for managing your databases, offering a user-friendly alternative to traditional database management tools. Now, you’re ready to streamline your database administration tasks with ease!