Fresh Virtualmin install - MySQL root password?


I’ve searched and searched as this seems like such a newbie problem but after many hours still haven’t found the answer.

I did a fresh install of Virtualmin GPL on a fresh Cent OS 6 box. All went fabulously! Just one hitch… even though MySQL is running, I can’t seem to activate that Webmin module, it keeps telling my that my MySQL root user/pass info is incorrect (authentication fails).

Given this is a totally fresh install, and also given that I believe (from another forum thread) that the MySQL pass is set randomly on install, I figured I needed just to reset it and happily be on my way. But wherever I try to reset this password in Virtual/Webmin, I still get the authentication error when trying to setup the MySQL module. I’ve even tried resetting the pass for user ‘mysql’ and then putting that login info into the MySQL module setup (using ‘mysql’ instead of ‘root’ as the username), but still no luck!

I feel like I’m missing something obvious? Everything else worked so well out of the box, but without the ability to administer the running MySQL DB server using Virtual/Webmin, I’m at a bit of a loss.

Thank you for any insights!!

  • Elise

When you install Virtualmin and go through the initial set-up it asks you to provide a password for mysql - did you make a note of it?

If not you can reset the mysql root password via command line:

If there’s an easier way to do it I’m sure one of the Virtualmin staff/regulars will say…

I did the fresh install (of Virtualmin on a fresh server using the automatic script) twice and each time I wasn’t actually prompted to set a MySQL password… I would definitely have made note of it if so!

That MySQL step in the initial web configuration of Virtualmin actually fails because I don’t have this login information. I can see the MySQL process running, but can’t administer it via Virtualmin.

I tried the howtoforge link you suggested. Everything worked as it should and I set a new root password for MySQL. But when I try to “switch on” Virtualmin administration of MySQL in the System Settings > Features and Plugins, and I’m asked for the MySQL admin login/pass for Webmin to manage MySQL, I still get an access denied error, even using the user ‘root’ with my fresh new MySQL root password (carefully copied from my password program where I just stored it).

I did all the flushing of privileges recommended at howtoforge, and restarted the normal MySQL process. Should I restart my server? I’ll probably try that next, just in case it helps, and will post back if I get a different result. I can’t think of anything else odd, other than wondering if perhaps there are some special characters in my pass that won’t be warned about when resetting it, but may still cause a problem for Virtualmin? I’m not sure what to do next!

One thing I might do is simply try to gain access to MySQL from the command line, just to confirm that things are working as they should.

You can do that using this command:

mysql -u root -p

If you can’t log in there as root, it definitely wouldn’t work via Virtualmin either.

Note that by default, the MySQL password is unset – there would only be a MySQL password after setting one.


You’re right, I can’t login to MySQL on the command line.

Now that I look, when I go to reset the user root’s password (in MySQL safe), it tells me that 0 rows are affected. I tried setting a new password for user ‘mysql’ in case I should use that instead of ‘root’, but once again, 0 rows are affected. So perhaps the Virtualmin auto-install script didn’t add any users to MySQL when it installed it?

I’ve tried a few things but I can’t seem to setup a new root user for MySQL (assuming there isn’t one, and I’m not seeing any rows at all in here) while in MySQL safe mode. Shouldn’t the automatic Virtualmin script have setup a root user, or given a warning if that didn’t work out?

I have installed Virtualmin a few times over the last couple of months and mysql hasn’t been an issue at all - I remember Virtualmin asking for a password in the set-up stages.

Can you do an OS reload and set up Virtualmin again? Perhaps follow my guide here:

(Which distro are you using btw? I installed successfully on CentOS 5.8, Debian Squeeze, and CentOS 6.2)

It’s working! :slight_smile:

I did in fact do an OS reload once before to try to fix this, because it was a fresh system and I was trying out Virtualmin in any case. Each time I did a fresh install of Cent OS 6, added a system user, disabled root system access, uploaded SSH keys, changed the SSH port, updated server packages with yum, and then installed Virtualmin.

Each time I had the same problems with the MySQL authentication errors on initial configuration of Virtualmin. Here’s what worked: putting MySQL into safe mode, then browsing to the MySQL module config in Virtualmin (which loads up properly while in safe mode… I’d never thought to check!), then adding a root user there with all permissions enabled.

I then stopped the safe MySQL and started up the normal MySQL (and even double-checked by rebooting my server) and I can now login happily to MySQL on the command line, and the Virtualmin MySQL database management is working too!

I’m wondering if the reason no MySQL root user was setup each time by the Virtualmin script when it installed MySQL is simply due to the fact I’d disabled the main root login to my server? Or maybe there’s no connection there, and it’s just something in Cent OS 6? In any case, this is the fix!

Thank you all for your help, which definitely helped me continue in the right direction :slight_smile:


The Virtualmin script doesn’t do anything with MySQL users – the MySQL root user is setup by your Linux distribution when the MySQL RPM is installed. Prior to now, I’ve never heard of the root user not being there.

All Virtualmin does in regards to the MySQL users is prompt you to set a password, since root’s password is blank by default.

So, that’s all quite unusual! Are you performing an installation onto a dedicated server? Or are you using a VPS, with a OS image provided by your ISP?


Hmm… it’s a VPS with a Cent OS 6 image provided by MediaTemple. All I really did prior to installing Virtualmin was to run yum update.

For some reason, I thought Virtualmin installed Apache, MySQL, and PHP (among other things), and assumed it setup the root MySQL user as well.

I’m a newbie to Webmin/Virtualmin installations and am installing on CentOS 7.1-x86_64. I’m having the same problem. New VPS with new OS installation and I’m installing using the GPL script. Not only am I having problems with the ClamAV side (not for this thread) but I am also getting the ‘Virtualmin does not not know what the current MySQL root password is. It must be set here to allow Virtualmin to create new MySQL databases and users.’ message.
I’m 99.9% sure that I haven’t been prompted for a MySQL password during the installation and I have tried leaving it blank and also putting in the password for the root user for the VPS, but I keep getting ‘Incorrect MySQL password’

I’m hoping not to have to do an OS reload, obviously, but if that’s what I have to do, then that’s what I will have to do. Given the age of the last post here, I would have thought that there might have been a fix by now, but it seems not.

All input welcome.

Hi all. I’m delighted to say that I managed to crack it myself using the instructions here:

It worked like a dream. I never thought I would be saying ‘Thank you’ to GoDaddy, but there you go!