Setting a password for root user in MySQL

8 posts / 0 new
Last post
#1 Sun, 02/05/2006 - 11:45

Setting a password for root user in MySQL

I think you should probably provide an interface/mechanism for setting the root user passwords in MySQL after the database is installed.

There are two root user entries for MySQL (localhost and that don't have passwords initially.

I tried changing the root user password through Webmin, but it gave me an error:

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

It did appear to change the password, but just didn't recover nicely from this change. It probably should prompt you again for the log in user/password to access the database.

Anyway, this process seems to require a little more work.

Sun, 02/05/2006 - 11:48

BTW, my suggestion here is not just to fix the bug with manually setting the password for root, but is also a request to do the resetting earlier (maybe during installation or immediately thereafter). Or, make it clear somehow that users should change this (like an alert).

Fri, 12/14/2007 - 09:14 (Reply to #2)

Hi there,

I did same thing as you. I changed MySQL root password throw mysql shell and now I'm getting error when I'm trying to add/edit/update settings throw virtualmin panel I'm getting "Access denied for user 'root'@'localhost' (using password: NO)" error.

What should I do to get rid of that error and also protect root account with password?

Thank you

Tue, 09/13/2011 - 08:27 (Reply to #3)

I'm not sure if I missed something during install, but a warning regarding the blank passwords may be prudent. Especially since everything works so well 'out of the box'.

Tue, 09/13/2011 - 08:33 (Reply to #4)


Yup! You should receive a warning on an installation with no MySQL root password set.

That should appear when the first-time wizard is finishing up after you log into Virtualmin for the first time.

You can view it again by going into System Settings, and running "Re-Check Config".


Fri, 12/14/2007 - 11:57
Joe's picture

Hey guys,

You need to set the password for the Webmin MySQL module. It has no idea that you've changed the password or what you've changed it to--all it knows is that it can't connect anymore. Set this in the Module Configuration.

We do recommend changing the MySQL password, and include the steps for setting of it in the MySQL module, somewhere in the documentation...but I'm not seeing immediately where. I'll add it to the installation guide. It'll probably be added to the install script in the next few weeks.

You can also set the MySQL password from within Webmin, without having to hit the command line, in the User Permissions page.


Check out the forum guidelines!

Thu, 06/05/2008 - 23:13 (Reply to #6)

Hey Guys,

I don't get it... how do I set that root user password for MySQL? The Link on the starting page has disappeared...

Thank you

Thu, 06/05/2008 - 23:23 (Reply to #7)

Editing the root User in MySQL -User configuration, trying to change password from none to "mypassword" I get the message:

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

but then in the next step I had to log in again with the new password and recheck configuration now says:

"MySQL is installed and running."

So everything is fine now... Virtualmins message is not very helpful at that point...

Topic locked