No MySQL root user?!


I have a fresh install of Debian Lenny and i’ve just installed Virtualmin GPL without any issues.

However, now that I am configuring Virtualmin I cannot get past the MySQL root password page.

The error I get is:

DBI connect failed : Access denied for user ‘root’@‘localhost’ (using password: NO)

I’ve taken a look in the database and noticed that the only user I have is debian-sys-maint

What should I do?

Hmm, had you done the install, or did a provider do it for you? As I’ve never seen MySQL be installed without a root user before…

Where is it exactly that you’re seeing that error above?

In most cases, once you’ve gotten Virtualmin up and running, what you’d be able to do is go into Webmin -> Servers -> MySQL, choose “Change Administration Password”, and set a new one.

Does that work by chance, or is that where you’re receiving the error?


I re-imaged the box myself about an hour ago - it’s totally fresh.

I am getting the error on the page:

“Post-Installation Wizard”
MySQL password

Then when i goto webmin->servers->mysql I get a login prompt and an error:

The full MySQL error message was : DBI connect failed : Access denied for user ‘root’@‘localhost’ (using password: NO).

I’ve tried with several passwords.

I’ve just checked the database from SSH - and I can’t login with root but if I run

mysqld_safe --skip-grant-tables &

I only have one user:

mysql> SELECT User from user;
| User |
| debian-sys-maint |
1 row in set (0.00 sec)

This is very strange…

Can I uninstall mysql and reinstall it to get root back or anything?


Try running this as root:

dpkg-reconfigure mysql-server-5.0

Does doing that get that fixed up for you?


I tried that before and it didn’t give me a root user for some strange reason…

I’ve managed to add a root user to the mysql.user table and give it access - so i’ve got Virtualmin working just now. I’ll let you know if I run into problems.

Thanks for you help anyway,



I just ran into this issue on a new test server (Ubuntu 8.04). Here’s my take on the situation …

I installed mysql-server and mysql-client before installing Virtualmin 3.73.gpl. During mysql installation, I had already set the mysql root user’s password to XXXX.

Then, later in the Virtualmin Post Installation Wizard, it asks for the password so I type XXXX again. Virtualmin then tries to set the mysql root password to XXXX, but using its current (and uninitialised) credentials of …

user ‘root’@‘localhost’ (using password: NO)

which naturally fails because the root password is already set to something. Hence, I also got the error message

DBI connect failed : Access denied for user ‘root’@‘localhost’ (using password: NO).

Later I went to Webmin’s mysql module configuration page and set the mysql root password to XXXX and everything worked fine afterwards.

So, I think this is just a small bug in the Post Installation Wizard. If it can’t set the root password using current credentials, it should then perhaps try to confirm that the supplied password is, in fact, already the one in use.