How to connect to your DBaaS instance using PhpMyAdmin?

PhpMyAdmin is a convenient way to connect to your DBaaS instance and manage your databases. In this guide, we will be explaining how to connect to your E2E DBaaS instance using phpMyAdmin.

Pre-requisite: Have running DBaaS in E2E

DBaaS Connection Details Page

Before trying to connect to the DBaaS, please make sure that the DBaaS is created and running. Please make note of the database name, DBaaS user and its password.

Installing PhpMyAdmin

You can install phpMyAdmin using the following command on Ubuntu and Debian distributions.

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl -y

Configuring PhpMyAdmin

After running these commands, you will receive a prompt to choose which webserver you would like to use.

Prompt to choose webserver for PhpMyAdmin

You may choose whichever webserver you want but as rule of thumb, Lighttpd is more lightweight that Apache2.

For now, we will be choosing Apache2 for simplicity.


Now, you may follow the prompt and setup the configuration of your PhpMyAdmin using dbconfig-common but we are going to make it more convenient. We will edit the /etc/dbconfig-common/phpmyadmin.conf file. Please note that editing it requires root priviledges.

sudo vim /etc/dbconfig-common/phpmyadmin.conf
# automatically generated by the maintainer scripts of phpmyadmin
# any changes you make will be preserved, though your comments
# will be lost!  to change your settings you should edit this
# file and then run "dpkg-reconfigure phpmyadmin"

# dbc_install: configure database with dbconfig-common?
#              set to anything but "true" to opt out of assistance

# dbc_upgrade: upgrade database with dbconfig-common?
#              set to anything but "true" to opt out of assistance

# dbc_remove: deconfigure database with dbconfig-common?
#             set to anything but "true" to opt out of assistance

# dbc_dbtype: type of underlying database to use
#   this exists primarily to let dbconfig-common know what database
#   type to use when a package supports multiple database types.
#   don't change this value unless you know for certain that this
#   package supports multiple database types

# dbc_dbuser: database user
#   the name of the user who we will use to connect to the database.

# dbc_dbpass: database user password
#   the password to use with the above username when connecting
#   to a database, if one is required

# dbc_dballow: allowed host to connect from
#       only for database types that support specifying the host from
#       which the database user is allowed to connect from
#       this string defines for which host the dbc_dbuser is allowed
#       to connect
#       this value is only really used again when you reconfigure the
#       package

# dbc_dbserver: database host.
#   leave unset to use localhost (or a more efficient local method
#   if it exists).

# dbc_dbport: remote database port
#   leave unset to use the default.  only applicable if you are
#   using a remote database.

# dbc_dbname: name of database
#   this is the name of your application's database.

# dbc_dbadmin: name of the administrative user
#   this is the administrative user that is used to create all of the above
#   The exception is the MySQL/MariaDB localhost case, where this value is
#   ignored and instead is determined from /etc/mysql/debian.cnf.

# dbc_basepath: base directory to hold database files
#   leave unset to use the default.  only applicable if you are
#   using a local (filesystem based) database.

## postgresql specific settings.  if you don't use postgresql,
## you can safely ignore all of these

# dbc_ssl: should we require ssl?
#   set to "true" to require that connections use ssl

# dbc_authmethod_admin: authentication method for admin
# dbc_authmethod_user: authentication method for dbuser
#   see the section titled "AUTHENTICATION METHODS" in
#   /usr/share/doc/dbconfig-common/README.pgsql for more info

## end postgresql specific settings

We will make the following edits:

Setting DBaaS user

  • In line 27, we will set dbc_dbuser =’toor’. You have to set this to your DBaaS username.

  • In line 32, we are going to set dbc_dbpass = <DBaaS-password>. You have to set this to your DBaaS password.

  • In line 46, we will set dbc_dbserver = You have to set this to your DBaaS endpoint value.

  • In line 55, we will set dbc_dbname = db. You have to set this to your DBaaS database name.

  • In line 61, the value will be set to dbc_dbadmin = ‘toor’. You have to set this to your DBaaS username.

  • In line 75, set the value to dbc_ssl = true. We recommend setting this value to true in order to make the connection to your DBaaS more secure.

After this, run the command

sudo systemctl restart apache2.service

If you find the above method difficult to implement, you can always run the following command and follow the prompt accordingly. Please note to use your DBaaS username for both the user and the administrator.

sudo dpkg-reconfigure phpmyadmin

This concludes our configuration of phpmyadmin to connect to your E2E DBaaS.

Accessing PhpMyAdmin

You can access your PhpMyAdmin panel by opening your browser and going to the URL http://localhost/phpmyadmin