How To Deploy Adminer Database Administration Tool On Ubuntu Server 22.04

If you’re looking for an easy-to-use, web-based GUI to administer your relational and NoSQL databases, Jack Wallen might have what you’re looking for in Adminer.

Image: monsitj/Adobe Stock

If you are a fan of phpMyAdmin, you know how easy this platform is to manage relational databases. But what if you need to manage more than one type of database? You may be working with relational and NoSQL databases. If so, who do you turn to?

One option is Adminer, which supports MySQL versions 5, 7, and 8, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, Elasticsearch, MongoDB, SimpleDB via plugin, Firebird via plugin, and ClickHouse via plugin.

Adminer’s feature list is quite impressive and includes things like:

  • Login to database server via username and password
  • Database creation
  • List by fields, indexes, foreign keys and table triggers
  • Edit table name, engine, collation, auto-increment, and comment
  • Change column name, type, collation, comment, and default values
  • Add and remove tables or columns
  • List data in tables with search, aggregate, sort and limit results
  • Insert, update, and delete records
  • Supports all data types and blobs via file transfer
  • Execute any SQL command
  • Show and kill processes
  • View and edit users and rights

To view the full list of features, check the official Adminer website.

SEE: Recruitment Kit: Database Engineer (TechRepublic Premium)

I want to walk you through the process of installing Adminer with MySQL.

What you will need to install Adminer

To get Adminer up and running, you’ll need an Ubuntu Server instance – I’m demoing on 22.04, but you can also use 20.04 – and a user with sudo privileges. That’s it: let’s create some magic in the database.

How to install MySQL

I will demonstrate Adminer with MySQL database. Just to make sure everything is installed, we’ll go the full LAMP (Linux Apache MySQL PHP) stack route by running the command:

sudo apt-get install lamp-server^ -y

Once the installation is complete, start and enable the MySQL and Apache services with the following commands:

sudo systemctl enable --now apache2
sudo systemctl enable --now mysql

Next, secure the MySQL installation and give the admin user a password with the command:

sudo mysql_secure_installation

Now we can link to the Apache configuration file with the command:

sudo ln -s /etc/apache2/conf-available/adminer.conf /etc/apache2/conf-enabled/

Restart Apache with:

sudo systemctl restart apache2

How to access the Admin web interface

Believe it or not, that’s all there is for installation. However, you cannot log in using MySQL administrator credentials. Instead, you must create another user with permission to create databases. To do this, connect to the MySQL console with the command:

sudo mysql

Create a new user (we’ll call it dbadmin, but you can name it whatever you want) with the command:

CREATE USER 'dbadmin'@'%' IDENTIFIED BY 'PASSWORD';

Where PASSWORD is a strong/unique password.

Give the user global rights reload with:

GRANT CREATE USER, RELOAD  ON *.* TO 'dbadmin'@'%';

Grant the necessary rights with:

GRANT ALL ON `db`.* TO 'dbadmin'@'%' WITH GRANT OPTION;

Notice, in the command above, on either side of db are backticks, not single quotes. If you run the command with single quotes, an error will occur.

Finally, grant the user creation privileges with:

GRANT CREATE, CREATE USER, SELECT, RELOAD  ON *.* TO 'dbadmin'@'%';

Purge privileges and exit with:

FLUSH PRIVILEGES;
exit

You can now point a web browser to http://SERVER/adminer, where SERVER is the IP address of the hosting server, and be greeted by the Adminer login window (Figure A).

Figure A

The Admin login window.

At this point, you should be able to create and modify databases to your heart’s content as an administrator (Figure B).

Figure B

Adminer is now ready to serve your dbadmin needs.

And it’s that simple to run Adminer on a MySQL database. Try this platform with the database you need to work with and see if that doesn’t make your job much easier.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech tips for professionals from Jack Wallen.

Maria H. Underwood