locked myself out of mysql

ok, so everything was going great, and i'm loving virtualmin and the support...

anyway, i've done something stupid. I was trying to connect to mysql from external (outside firewall) and nothing I would do would allow me to connect to any of the mysql databases, including root level. I am not a mysql newbie but I used webmin to edit the local host to allow all, but now I seem to have locked myself out of all mysql access thru virtualmin with the error:

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

I even tried stopping the mysql service and restarting with --skip-grant-tables

How do I get mysql back to allowing root user access via localhost if I removed root access via localhost?

Thanks

Status: 
Closed (fixed)

Comments

If you start the MySQL service with the --skip-grant-tables option, are you then able to access MySQL from the command line?

For example, can you run "mysql -u root", and gain access to MySQL that way?

I was able to gain access via command line but I can't quite figure out how to grant root access to connect via localhost again, which totally cripples virtualmin. You cannot run grant commands with the ==skip-grant-tables option.

That's okay, we'll be getting this straightened up from the command line :-)

First, run this command from the command line to log into Virtualmin and access the MySQL table:

mysql -u root mysql

Then, run this SQL command:

select Host from user where user = 'root';

What output does that produce?

Thanks for the assistance. Before I got your most recent reply I already reinstalled since it was a brand new system anyway and quicker to wipe clean and reinstall then troubleshoot further. there was no data on the system anyway.

In any case, i did try to insert 'localhost' back into the user table of mysql because it was missing but that didnt work. i was trying to restore root's ability to login from localhost.

Okay, I'll mark this as fixed then.

If you have any other questions, feel free to let us know!

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