Cannot login to the Mysql Server created by Virtualmin using root user and password

Well, joy not for long cos now I cant connect to the virtualmin installed mysql server via Virtualmin and even on the console I can only connect without password but I cannot even create a database. From the Debian terminal

That works

mysql -u root That works too

mysql -u root -p Works ONLY IF I do not enter a pw but just press enter. Else if use a pw gives the following error: Access denied for user ‘root’@‘localhost’ (using password: YES)

In all cases that worked, I get error when I try to create a database like so: create database test2; ERROR 1044 (42000): Access denied for user ‘’@‘localhost’ to database ‘test2’

I dont know It seems strange cos even when I use mysql -u root it still says user ‘’@‘localhost’ indicating no current username.

To change the root password, I tried to use mysqladmin command but that gave me error too so I put the mysql server in safe mode and edited the password field of the user table in the default mysql database.

UPDATE user SET Password=PASSWORD(‘mypassword’) WHERE User=‘root’;

But on the command line I still cant login with the new pw i created.

mysql -u root -p Enter password: Access denied for user ‘root’@‘localhost’ (using password: YES)

On Webmin->Servers->Mysql server I try to make a database connection too but I get similar error(s). I tried the module config link to set a mysql server log on info. Error: DBI connect failed : Access denied for user ‘’@‘localhost’ (using password: YES)

Could anyone point me to how I can get the root user to login with a password? I have confirmed that the password is set.

Also i have never seen this where root user has login problems. Could there be a problem with this installation since it is done automatically with virtualmin?

Any clues anyone? Thanks


Did you perform the Virtualmin installation using the script?

After performing the initial Virtualmin installation, when you log into Virtualmin, it will then prompt you to enter a MySQL password, and it would handle setting all that for you… it shouldn’t be necessary to do that from the command line.

One thing you may want to try is to go into System Settings -> Re-Check Config – if there isn’t a password set, it should offer to do so there on that screen.


I have that issue as well… fresh debian 8.4 install… suddenly I cannot set root password on post install wizard