PHPMyAdmin

This article will show you how to install PHPMyAdmin. PHPMyAdmin provides a more user-friendly way to manage databases than the MySQL command line.

You'll need to execute some commands via SSH to use this software. There is a separate guide on how to connect to your slot via SSH. Commands are kept as simple as possible and in most cases will simply need to be copied and pasted into the terminal window (then executed by pressing the Enter key).

Table of contents

Installation - bash script

The following script will allow you to do install and uninstall PHPMyAdmin easily. To run it, simply log in via SSH then copy and paste the following:

wget -qO ~/install.phpmyadmin.sh https://bitbucket.org/feralio/wiki/raw/HEAD/src/wiki/software/phpmyadmin/phpmyadmin.sh && bash ~/install.phpmyadmin.sh

Follow the on-screen istructions to either install or uninstall PHPMyAdmin. Once installed, the URL you need to access the software will be displayed.

Installation - manual

Install PHPMyAdmin by logging in via SSH, then copying and pasting the following:

wget -qO ~/phpMyAdmin.zip https://files.phpmyadmin.net/phpMyAdmin/4.7.7/phpMyAdmin-4.7.7-all-languages.zip
unzip -qo ~/phpMyAdmin.zip -d ~/
mkdir -p ~/www/$(whoami).$(hostname -f)/public_html/phpmyadmin
cp -rf ~/phpMyAdmin-*-all-languages/. ~/www/$(whoami).$(hostname -f)/public_html/phpmyadmin
cd && rm -rf phpMyAdmin{-*-languages,.zip}

Configuring the manual installation

Once all that is done, access the PHPMyAdmin setup page to configure your MySQL instance. The setup page is accessible at:

http://server.feralhosting.com/username/phpmyadmin/setup/

In the above command, replace server with the name of your server (e.g. mimas or zeus) and username with the slot's username.

On that page press the New server button. Fill in the details as follows:

Verbose name of this server
Pick a name of your own choosing, or leave it blank
Server hostname
Clear this field entirely
Server socket
Your MySQL socket - this is provided on your software page

Then click on Display to bring up the config we just created. Go to your SSH terminal window and execute the following command:

nano ~/www/$(whoami).$(hostname -f)/public_html/phpmyadmin/config.inc.php

Copy the config displayed on PHPMyAdmin's setup page and paste it (with shift + insert into the terminal window

Once you're done hold ctrl + x to save. Press y to confirm.

Finally, run the following command in the SSH terminal window so that you can use PHPMyAdmin via HTTPS:

sed -ri "s|$i = 0;|$i = 0;\n\$cfg['PmaAbsoluteUri'] ='https://$(hostname -f)/$(whoami)/phpmyadmin/';|g" ~/test

PHPMyAdmin will then be accessible at:

https://server.feralhosting.com/username/phpmyadmin/

In the above command server is replaced by your server name (e.g. mimas or zeus) and username is replaced by the slot's username. You can log in using the MySQL details found on your software page to the left-hand side.

Troubleshooting

When trying to log in to PHPMyAdmin I get an error "Cannot log in to the MySQL server"

Make sure you're entering the correct MySQL username (by default, root) and password. If you're sure you are, you've most likely misconfigured PHPMyAdmin. Please go through the setup again.

Uninstallation

rm -rf ~/www/$(whoami).$(hostname -f)/public_html/phpmyadmin/