Virtualmin & Webmin locked out of administration area due to MySQL error

I desperately need help. I did something and really messed up my administrative abilities.

I am logged in to virtualmin as root, but if I try to access things like "Edit Users", I always get the same error.

DBI connect failed : Access denied for user 'comtoistech'@'localhost' to database 'mysql'

I tried the suggestions on other topics for resetting passwords via the terminal but nothing has fixed the issue.

What I don't understand is that I can log into phpmyadmin as the user "comtoistech" without a problem, and my website seems to be working ok, mostly.

If I am logged in as root, why is it telling me it can not access mysql as comtoistech@localhost.

I think this may have started when I was changing some user names to reflect the new domain, and I may have removed one under the old name, but can't be certain.

I read somewhere that you can just add the user under localhost but I can't find anywhere to do that, and if I try to access anything under Webmin for Mysql, like user permissions, database permissions, or host permissions, I get the same error.

Status: 
Closed (fixed)

Comments

You may have configured Webmin with the wrong credentials for logging into MySQL.

Try going to Webmin -> Servers -> MySQL Database, and enter the correct root login and password for MySQL.

Hi Jamie,

Thanks for the quick reply...

That's just the problem....I can't even do that...if I go to Webmin >Servers > MySQL Database and try to open User Permissions or Database permissions, Table Permissions Field Permissions, or any of the option on that screen I get the error.

That is what I meant by administrative lockout.

I can give you access if you want to see for your self how far the lockout goes.

What do these two commands output... this will show what Webmin/Virtualmin is using as the master MySQL login:

grep login= /etc/webmin/mysql/config
grep pass= /etc/webmin/mysql/config

grep login= /etc/webmin/mysql/config login=comtoistech

grep pass= /etc/webmin/mysql/config pass=Comtoistech2012

Yeah it looks like Webmin is configured to use the user "comtoistech" to access MySQL. That would normally use root.

My suggestion would be to edit the file /etc/webmin/mysql/config, and to change the login= line to be "root", and then change pass= to your root MySQL password.

Once you do that, restart Webmin with this command:

/etc/init.d/webmin restart

After that, does it work correctly?

I think I changed it somehow previously because my joomla website was giving me an error about not being able to connect to the the database. I can't recall how or where I did it.

I'll try you suggestion and get back to you on the results. Thanks Jamie

Jamie You are the BEST!

Worked like a charm! I have access to everything again!

This has been stumping me for months, and you fixed it so easily! You are awesome! I owe you a beer my friend.

I also noticed old references to my old database name "promaxia" which I changed over to "comtoistech" in the file. Everything seems to be working smoothly again. I am so happy. I was about to give up and start all over from scratch and build a new server, but you saved me from that nightmare. Thanks so Much!

You have my ever lasting gratitude. You are a genius!

Paul

Great! I will mark this as fixed then ..

Automatically closed -- issue fixed for 2 weeks with no activity.