Virtualmin should set up new users with '%' as host.

Hi there,

My Virtualmin setup is running on ubuntu 16.04 and using an external MySQL server.

When Virtualmin creates a new virtual server and 'Create MySQL Database' is checked under 'Features', it should create a database on the external MySQL server as well as a mysql user who has permissions to access the database.

I find, however, that it creates three users with the same name: one, with it's host as 'localhost'; another as: '127.0.0.1'; and the third, as the fqdn of the server, in my case: 'panel.vuonline.co.uk'. When virtualmin tries to connect to the database it just created through this user, it fails. However, if I manually change the host of one of these MySQL users to '%', the MySQL symbol for any, Virtualmin has no problem access the database. Is this a bug therefore, that Virtualmin sets up new database users with the wrong host, such that it cannot access databases it creates?

Thanks for your help!

Status: 
Closed (fixed)

Comments

Howdy -- hmm, does "panel.vuonline.co.uk" resolve to your server's primary IP address? If it doesn't, that could explain the issue you're experiencing there.

You'd want to ensure that there is a DNS 'A' record setup that associates "panel.vuonline.co.uk" with your server's IP address.

VuOnline's picture
Submitted by VuOnline on Tue, 10/04/2016 - 11:22

Hi andreychek,

Yes, panel.vuonline.co.uk does resolve to my servers primary ip address.

Thanks for your help again!

VuOnline's picture
Submitted by VuOnline on Tue, 10/04/2016 - 11:33

I have discovered that, as well as '%', I am able to connect if the user's host is '10.0.0.222' (which is my servers local ip address). This makes sense because the MySQL server must see the request coming from the host with ip address 10.0.0.222 and would grant permission if it has a rule for that (or %, of course).

Since MySQL doesn't try to resolve dns (it just matches the request user@host to what is in the user and host column of the mysql.users table) then the problem is that Virtualmin, by default, creates mysql users with the wrong value in the host column. How should I go about changing this?

You can configure the hosts used in MySQL permissions in Virtualmin, at System Settings -> Server Templates -> Default Settings -> MySQL Database.

VuOnline's picture
Submitted by VuOnline on Wed, 10/05/2016 - 06:36

Excellent advice JamieCameron, thats exactly what I was hoping for.

Have a nice day!

VuOnline's picture
Submitted by VuOnline on Wed, 10/05/2016 - 06:36

Status: Active ยป Fixed