On MySQL world, phpMyAdmin is one of the most popular tool to managing MySQL database. phpMyAdmin is using web as its front-end and make it can be accessed from anywhere. Now we will discuss about Adminer as a database management tool.
What is Adminer
Adminer is a full-featured database management tool written in PHP. It consist of a single PHP file which is ready to deploy on the target server. Adminer is Free for commercial and non-commercial use.
Adminer support a lot of features. Here’s a list of Adminer features
- Works with MySQL, PostgreSQL, SQLite, MS SQL, Oracle, SimpleDB, Elasticsearch, MongoDB
- Supports PHP 5 with enabled sessions
- Available in 31 languages such as : Arabic, Catalan, Chinese, Czech, Dutch, English, Estonian, French, German, Hungarian, Italian, Japanese, Lithuanian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Tamil, Turkish, Ukrainian
- Connect to a database server with username and password
- Select an existing database or create a new one
- List fields, indexes, foreign keys and triggers of table
- Change name, engine, collation, auto_increment and comment of table
- Alter name, type, collation, comment and default values of columns
- Add and drop tables and columns
- Create, alter, drop and search by indexes including fulltext
- Create, alter, drop and link lists by foreign keys
- Create, alter, drop and select from views
- Create, alter, drop and call stored procedures and functions
- Create, alter and drop triggers
- List data in tables with search, aggregate, sort and limit results
- Insert new records, update and delete the existing ones
- Supports all data types, blobs through file transfer
- Execute any SQL command from a text field or a file
- Export table structure, data, views, routines, databases to SQL or CSV
- Alter export for projecting changes to production database
- Print database schema connected by foreign keys
- Show processes and kill them
- Display users and rights and change them
- Display variables with links to documentation
- Manage events and table partitions (MySQL 5.1)
- Schemas, sequences, user types (PostgreSQL)
- Extensive customization options
Since Adminer is a PHP file, we need :
- A working web server that can read PHP file.
- A PHP connector into the database. For example, if we want to connect to MySQL database, we need MySQL module for PHP, such as php5-mysqli.
Adminer is available in source package, Debian package and Arch Linux package.
On Debian / Ubuntu based Linux
$ sudo apt-get install adminer
$ sudo /etc/init.d/apache2 restart
Then you can browse it through this address : http://your_server_name_or_ip/adminer
The latest version of Adminer at the time this article is written is version 4.0.2. But on Debian package, it still at the 3.3.3 version. So if you are using apt-get tool, you will get 3.3.3 version.
To upgrade it into the latest version, we need to use it’s source code file. Installation using source file can be applied in most Linux distribution.
Before we continue, please notice that we only show to you that how easy to setup Adminer using Apache as a web server. But since managing database should be installed in a secure way - such as using .htaccess file -, this installation may not the best installation from security point of view.
Here are the steps :
1. Download the latest version of Adminer
$ wget http://downloads.sourceforge.net/adminer/adminer-4.0.2.php
2. Create a directory named adminer (or any name you want) in Apache DocumentRoot directory
Let say that the Apache DocumentRoot directory is /var/www
$ mkdir /var/www/adminer
3. Copy the file - adminer-4.0.2.php - into the adminer directory
$ cp adminer-4.0.2.php /var/www/adminer
4. Start using Adminer
Browse adminer through address http://your_server_ip/adminer/adminer-4.0.2.php or http://your_server_name/adminer/adminer-4.0.2.php
Adminer provide a clean login page. We only need to fill what kind database we are using, the server address, username, password and database (optional).
After those fields are filled correctly, then you will see a database administration page.
From here, you can choose to create a new database, or using the existing databases.
To manage privileges, we can go to Privileges link which located the home page. The page to manage it is pretty neat and straight forward.
To select a table on a database, just click the table name. Then the table detail will show on the right pane. While on the left pane, we will have a shortcut to select the data on the table (represent by select link) and table name.
To view the table content, you can click Select data link on the top area, or click select link beside the table name on the left area.
If you want to use a custom SQL command, you can click SQL command link on the left pane. It will bring you a big box to let you write your SQL command. Once it finish, click Execute.
Adminer allow you to change it theme or skins. There are some skins available on the Adminer website. For example, we download the skin called Nette, created by David Grudl.
$ wget https://raw.github.com/vrana/adminer/master/designs/nette/adminer.css
Then copy the file (adminer.css) to the same directory where the adminer-4.0.2.php is located.
$ cp adminer.css /var/www/adminer
Refresh Adminer page
Changing the database engine
Since Adminer support multiple database engine, you can switch to another database engine without need to install another version of Adminer. On the above examples, we discuss about connecting Adminer to MySQL database. If you have - let say - a working and configured postgreSQL database engine, you can connect it using Adminer just in a single click.
Here’s a screenshot of connecting Adminer to postgreSQL database engine.
Once it success, you will see a database administration page.
Adminer has a very small size (under 500 kb), easy to install and fast response. You can easily switch to the database that supported by Adminer such as MySQL, postgreSQL, Oracle or MS SQL without the need to install additional software. Adminer also supports plugins to extend its capability. A list of available plugins can be seen at Adminer Plugins page. To explore more about Adminer, you can visit Adminer website.