How to associate MySql database to virtual server

I’ve created a virtual server in Virtualmin. Now I want to associate a database that already exists in MySql module to this virtual server. I can’t figure out how to do it? What triggers a MySql database to appear under Edit Databases in one virtual server and not another?

Answer: Goto to Edit Databases and click on the Import Databases tab.

Also, if Edit Databases link in left menu of Virtualmin is not there then goto to Edit Virtual Server, expand Enabled Features, check MySQL Login enabled and click Save Virtual Server

Here’s another related observation.

If you create a new Virtual Server without MySQL login then the Edit Databases link does not show up on the left menu. If you now want to add (associate) a database to your virtual server that already exists in MySQL then you have to do the following:

  • edit virtual server
  • expand enabled features
  • check off add MySQL login
  • click on Edit Databases in left menu
  • click on Import Database tab and select database you want to ‘import’
  • then delete testdb as a result of add MySQL login process