How to deploy the Adminer database admin tool on Ubuntu Server 22.04

Estimated read time 4 min read


If you’re looking for a simple-to-use web-based GUI for administering your relational and NoSQL databases, Jack Wallen may have what you’re looking for in Adminer.

Big data futuristic visualization abstract illustration
Image: monsitj/Adobe Stock

If you’re a fan of phpMyAdmin, you know how easy that platform makes managing relational databases. But what if you need to manage more than one type of database? Maybe you work with both relational and NoSQL databases. If that’s the case, where do you turn?

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.

The feature list of Adminer is pretty impressive and includes things like:

  • Database server connection via username and password
  • Database creation
  • List by fields, indexes, foreign keys and table triggers
  • Edit name, engine, collation, auto_increment and comment for tables
  • Alter the name, type, collation, comment and default values for columns
  • Add and drop 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
  • Display and edit users and rights

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

SEE: Hiring Kit: Database engineer (TechRepublic Premium)

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

What you’ll need to install Adminer

To get Adminer up and running, you’ll need an instance of Ubuntu Server — I’m demonstrating on 22.04, but you can also use 20.04 — and a user with sudo privileges. That’s it: Let’s make some database magic.

How to install MySQL

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

sudo apt-get install lamp-server^ -y

After the installation completes, 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 create a 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 Adminer web interface

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

sudo mysql

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

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

Where PASSWORD is a strong/unique password.

Give the user reload on global rights with:

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

Grant the necessary rights with:

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

Do notice, in the above command, on either side of db are backticks and not single quotes. If you run the command with single quotes there, it will error out.

Finally, grant the user create privileges with:

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

Flush 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 Adminer login window.

At this point, you should be able to create and modify databases to your admin heart’s desire (Figure B).

Figure B

Adminer is now ready to serve your dbadmin needs.

And that’s how easy it is to get Adminer up and running on top of a MySQL database. Give this platform a go with whatever DB it is you need to work with and see if it doesn’t make your job considerably easier.

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



Source link

You May Also Like

More From Author