Migrating a website from another server I had to manually copy mysql files to /var/lib/mysql directory (since there was no archived version and there was no possibility to create one). Fortunately everything was went smoothly, mysql on my server correctly saw the files, Virtualmin’s module list also is showing new DB in the list of MySQL Databases.
The only problem is that I have created a virtual server without mysql database and linked to mysql directly from the configuration file of the site, and now whenever I try to create sub-server it naturally displays the error in subject. Now, I don’t mind to create databases and database users fro sub-servers manually, it will work anyway, however I thought that maybe there is a way to make Virtualmin to recognize manually created existing connections between virtual servers and mysql databases and not to give that error?
You can associate a database with a given Virtual Server by going into Edit Databases -> Import Database. From there, you can see a list of databases that aren’t currently “owned” by a Virtual Server.
I can’t find section for Edit Databases.
Clicking on Webmin -> Servers -> MySQL Database Server gives only the following options:
Create a new database
Drop Selected Databases
MySQL Server Configuration
MySQL System Variables
Change Administration Password
Hrm, well, the option I’m referring to is a Virtualmin option… select the domain in question, then click “Edit Databases”.
However, I don’t think my suggestion as worded above will work
I think what you’d need to do is to temporarily turn off the initial creation of a MySQL database.
To do that, go to System Settings -> Server Templates -> Default Settings -> MySQL Database -> Create database as well as login?, and set that to “no”.
Once this is done, you should be able to create your desired Virtual Server (or, a Sub-Server in your case).
After that, in Virtualmin (not Webmin), you can import the database using Edit Databases -> Import.
Well, if virtual server was not initially created with a database, then you don’t see Edit Databases option on Virtualmin. Anyway, thanks for the suggestion as I noted above creating databases separately from Virtual server works just ok, so this is not a big problem. You just have to manually create separate databases for all subservers too. And I thought maybe there should be a possibility to associate existing databases for the virtual servers which initially were not created with databases.
And I thought maybe there should be a possibility to associate existing databases for the virtual servers which initially were not created with databases.
Yup, you should certainly be able to do this
If you don’t see the “Edit Databases” link, you may still need to enable the database feature for that Virtual Server… you can do that by clicking Edit Virtual Server -> Enabled Features, and enabling the MySQL Database feature.
But remember, before doing that, you may need to disable the creation of a MySQL database when enabling MySQL.
Hi Eric, today I revisited this page and following your instructions turned off automatic creation of database and then tried to edit virtualserver, unfortunately it still gives: Failed to modify server : A MySQL database named vsname already exists
Update: I had to:
- Manually rename existing database and remove associated mysql user
- Edit the virtual server, so that it had database by default
- Overwrite automatically created database with the old one
And Now everything looks right and I can create subdomains with database.