MySQL User Creation fails for new domains on MySQL


Whenever I try to create a new virtual machine, I always get an error:

MySQL database failed! : mysql::execute_sql_logged failed : SQL alter user 'username'@'localhost' identified by 'password' failed : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'user 'username'@'localhost' identified by 'password'' at line 1 at /usr/share/webmin/ line 1496.

I am using: mysqld Ver 10.1.44-MariaDB-0ubuntu0.18.04.1 for debian-linux-gnu on x86_64 (Ubuntu 18.04) and mariadb Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

I had this issue in my test environment and I thought I might have done something wrong, so wiped off the server and rebuilt it from the scratch and it worked fine.

But today when we tried creating a new virtual server we faced the same issue and so we started digging deeper and found a lot of people on the community are also having this issue from last 1-2 years, for example here is just one of the many links; ( I nmy opinion this should have been a major issue and so I am surprised this issue is still open unless there has been yet another update from MariaDB or MySQL.

I have found lots of so calle solution/workaround - but I am not sure how to implement i... for example have a look at this which @Jamie posted:

So I finally downgraded from 6.09 to 6.05 - obviously I don't want to be so far behind, but as this is a production box with customer data, I cannot take chance.

So please help me out with a permanent and/or long term fix.

Many Thanks, Rav

Closed (fixed)



Thanks for sharing the link, but I myself posted this link in my question itself - after a lot of research online.

But this is not helpful, as it does not say, which file to edit, what is the path of that file and if it is an edit or additional piece of code that needs to be written or copy-paste in that particular file.

A detailed help will be really appreciated.

Many Thanks, Rav

Ilia's picture
Submitted by Ilia on Thu, 05/14/2020 - 10:46

All files are under:


Opening links you will see the sub-path and the file name:

Thank you.

Will you include this patch in next versions of virtualmin ?


Thank you.

Will you include this patch in next versions of virtualmin ?