How to use PHPMyAdmin

in MySQLNginx configuration Tags: MySQL

By popular request we’ve added PHPMyAdmin to all Hypernode nodes. This article will explain how you can use PHPMyAdmin and how to create a database dump.

By default it is accessible at http://appname.hypernode.io/phpmyadmin

For protection, phpmyadmin by default is only accessible through the appname.hypernode.io/phpmyadmin url and on vagrant on the appname.hypernode.local/phpmyadmin url. You can adjust this behaviour to your own preference.

Working with PHPMyAdmin

Access PHPMyAdmin

  • Log in to the Byte Service Panel
  • Select your Hypernode plan
  • Click on the Hypernode tab.
  • Click PHPMyAdmin
PHPMyAdmin is accessible through the Service panel

Use PHPMyAdmin on Hypernode

(Or just use http://appname.hypernode.io/phpmyadmin)

You can log in using the credentials supplied in your .my.cnf file or through the user/password you might have created

Create a database dump using PHPMyAdmin

  • Go To http://appname.hypernode.io/phpmyadmin
  • Click on “Databases” and select the database.
  • Click on “Export”.
  • Click on “Go” and the export/backup will be available.

If you have a large database, making a database dump through PHPMyAdmin is not very reliable. Before importing it, make sure the integrity of your database dump is sane!

Configure PHPMyAdmin

Create whitelisting and/or basic_auth config

If you haven’t created a whitelist or basic_auth config using include files to protect your phpmyadmin from unsolicited ip addresses, do this first before you follow the instructions below.

Using PHPMyAdmin over SSL or through another url

When you redirect all traffic to https, you might experience a SSL browser error when connecting to PHPMyAdmin as the ssl certificate of your domein does not match the .hypernode.io domain name.

To avoid this, there are 2 possible solutions:

  • Use Letsencrypt and create a ssl certificate for appname.hypernode.io.
  • Adjust your nginx config to make PHPMyAdmin accessible through another url then appname.hypernode.io.

For the latter, use the instructions below.

Reroute /phpmyadmin to /dbadmin and add a whitelist

When you want to use phpmyadmin over ssl, or you want to add a whitelist with ip’s that are allowed to access phpmyadmin, you can do so by moving phpmyadmin to another url that we can adjust to our needs:

  • First, create a symlink in /data/web/public:
ln -s /usr/share/phpmyadmin/ /data/web/public/dbadmin
  • Next, create a snippet in /data/web/nginx called server.phpmyadmin with the following content:
location /dbadmin {
    # Only allow ip addresses defined in /data/web/include.whitelist
    include /etc/nginx/app/include.whitelist;

    # Uncomment to secure phpmyadmin with additional basic_auth 
    # include /etc/nginx/app/include.basic_auth;

    try_files $uri $uri/ /dbadmin/index.php last;

    location ~ \.php$ {
        echo_exec @phpfpm;
    }
}

And finally visit PHPMyAdmin on https://yourdomain.nl/dbadmin

This will only add another url where phpmyadmin is accessible. If you only want to use this endpoint, block all access to /phpmyadmin too

Blocking all access to PHPMyAdmin

If you want to fully disable PHPMyAdmin, create the following snippet as /data/web/nginx/server.phpmyadmin:

## Block PHPMyAdmin
location ~* phpmyadmin {
    deny all;
}

Troubleshooting PHPMyAdmin

  • The PHPMyAdmin button in the control panel redirects to https:// and gives a 404 in Nginx

This is probably because you redirect ALL traffic over https. Try using PHPMyAdmin over ssl as explained above.

  • I’m receiving an error while dumping the database

Most of the time this happens when a database is large and you exceed the max_execution_time or memory_limit in php. If this happens try dumping your database on the command line

  • My PHPMyAdmin does not show any images

This happens when you redirect all traffic to https, causing mixed content errors in your browser. To solve this use PHPMyAdmin over ssl.

0