Recently I was working on a project and for that I had got a fresh VPS machine, and that machine has got nothing, so basically it was an unmanaged VPS and I have to work on it from scratch to make it up and running, so for that I install Ubuntu 18.04, Ubuntu is one of my favorite OS when it comes to server. Once I had an OS installed, and machine is booted I can install other things on it, but first thing I wanted to installed was a Control Panel so that I can easily manage server and do other stuffs on it like add websites, change DNS, add mail, create/edit databases, make allocations and so much more.
I can always got with cPanel, which is the most popular Control Panel but it comes with a very hefty cost and as I was working on a small project so I was not interested in buying cPanel, so I decided to go with Webmin, which is a very popular, and free.
So I installed Webmin/Virtualmin and everything was up and running, websites has been added, DNS entries were there, and everything was ready.
But now I need to import database so that I have website in its old state. Webmin/Virtualmin comes with a database manager in which you can make all database related task but I like to use PhpMyAdmin to manage database as it comes with easy to use UI.
Installing PhpMyAdmin is not an issue on Webmin/Virtualmin, all you need to do is login to your Webmin/Virtualmin admin panel and go to Webmin -> System -> Software Packages, and there you can search for PhpMyAdmin and install it.
But when I did and tried to access it via https://my-ip-address/phpymyadmin, I got error and instead of having login page, I was getting raw code, I tried installing some php modules, but never got it working.
After several trial and error, finally got a work around which we are going to use here.
Installing PhpyMyAdmin on Webmin/Virtualmin –
First we are going to make a sub-domain, let say mydb.mydomain.com, you can make it on any of your website which you have added on your Webmin/Virtualmin.
Once you have sub-domain registered, now select that sub-domain and click on Install Script from sidebar and then you will have PhpMyAdmin option under Available Scripts, select it and install it on your server.
Now we have to create a root user so that you can manage and do all task from it, for this go to Webmin -> Servers -> MySql Database Server, here click on User Permission and then create a new users.
Provide any name, set password, host will be your localhost, and in permission, select all permissions and Create it.
Now got to your sub-domain on which you had install PhpMyAdmin and you will get login page and you can login with the user you had just created.