*[QUICKFIX]* for MariaDB 10.2 - 10.4.7 !!!

25 posts / 0 new
Last post
#1 Wed, 07/31/2019 - 08:34
Christos_Tzeremes

*[QUICKFIX]* for MariaDB 10.2 - 10.4.7 !!!

1) Make backup of /usr/libexec/webmin/virtual-server/feature-mysql.pl >> cp /usr/libexec/webmin/virtual-server/feature-mysql.pl /usr/libexec/webmin/virtual-server/feature-mysql.pl_OR

2) Install Perl SHA1 library ( Thanx Baterka !! )

root# perl -MCPAN -e shell cpan> install Digest::SHA1

3) Upgrade MariaDB (Only installing new version is not enough!)

root# mysql_upgrade

4) make following patches to: /usr/libexec/webmin/virtual-server/feature-mysql.pl

  1. Comment or delete line: 2753 [add this 2 lines]

use Digest::SHA1 qw(sha1 sha1_hex);

return ("INSERT INTO global_priv (Host, User, Priv) VALUES ('$host', '$user', '{\"access\":".time().",\"plugin\":\"mysql_native_password\",\"authentication_string\":\""."*".uc sha1_hex(sha1($plainpass))."\",\"password_last_changed\":".time()."}')");

  1. Comment or delete line: 2756 [add this 2 lines again:]

use Digest::SHA1 qw(sha1 sha1_hex);

return ("INSERT INTO global_priv (Host, User, Priv) VALUES ('$host', '$user', '{\"access\":".time().",\"plugin\":\"mysql_native_password\",\"authentication_string\":\""."*".uc sha1_hex(sha1($plainpass))."\",\"password_last_changed\":".time()."}')");

  1. Comment or delete line(s): 2787&2788 [add this:]

my $mpass=uc sha1_hex(sha1($plainpass));

$sql = "update global_priv set Priv = '{\"access\":".time().",\"plugin\":\"mysql_native_password\",\"authentication_string\":\"*$mpass\",\"password_last_changed\":".time()."}' where user = '$user'";

-------------------- END

See the code @ https://pastebin.com/FuZ8aqfQ

Finaly restart webmin >> systemctl restart webmin AND VOILA !!! Now EVERYTHING its GREAT !!!! You can create DB and change user DB passwords !!!!

PS: I will contact with Virtualmin Team to add this fix to next updates !!!

Regards Christos Tzeremes IT Expert @ nasa.gr Thessalonikh GREECE [MACEDONIA] ctzeremes[at]nasa.gr

Thu, 08/01/2019 - 03:05
irieyuusuke

Thanks your work. I did try your change "feature-mysql.pl".

but, I got below error in the page "Edit Databases"every domains, and cannot create new vertual server.

500 - Error - Perl execution failed

Undefined subroutine &virtual_server::list_dom_mysql_databases called at /usr/libexec/webmin/virtual-server/feature-mysql.pl line 2555.

in CentOS7.6.1810 MariaDB10.2.26

Thu, 08/01/2019 - 07:41 (Reply to #2)
Christos_Tzeremes

Check the code at https://pastebin.com/FuZ8aqfQ

Maybe you delete or comment some other lines ...

The script still working with today update of MariaDB 10.4.7 !!!

Christos Tzeremes IT Expert @ nasa.gr Thessalonikh GREECE [MACEDONIA] ctzeremes[at]nasa.gr

Thu, 08/01/2019 - 13:30 (Reply to #3)
irieyuusuke

Thank you reply.

My code is below. https://pastebin.com/2s3qfAgJ

Is it cause of MariaDB version ?

so My MariaDB is 10.2.26

Fri, 08/02/2019 - 01:17 (Reply to #4)
irieyuusuke

I updated my mariadb from 10.2.26 to 10.4.7.

but I cannot work it.

it shows below error.

500 - Error - Perl execution failed

Undefined subroutine &virtual_server::list_dom_mysql_databases called at /usr/libexec/webmin/virtual-server/feature-mysql.pl line 2555.

You did additional coding, didn't you ?

Fri, 08/02/2019 - 16:59 (Reply to #5)
Christos_Tzeremes

My friend the changes you make in code is OK ... I forget to tell you to install Digest follow the instructions on post #11 from Baterka !!!

Christos Tzeremes IT Expert @ nasa.gr Thessalonikh GREECE [MACEDONIA] ctzeremes[at]nasa.gr

Thu, 08/01/2019 - 10:40
applejack

This doesn't work for me either. It would be useful if you could post the entire code for the sub get_user_creation_sql and sub execute_password_change_sql routines.

Thu, 08/01/2019 - 13:31 (Reply to #7)
irieyuusuke

What your MariaDB version ?

Thu, 08/01/2019 - 14:24 (Reply to #8)
applejack

I was doing this on a test server using MariaDB 10.2

Fri, 08/02/2019 - 05:47
Baterka

https://pastebin.com/FuZ8aqfQ https://pastebin.com/2s3qfAgJ

Both not working... Same error MariaDB 10.4

Fri, 08/02/2019 - 06:06
Jfro

Could there be a difference yes no socket?

Or allready with wrong / buggy / error script tried before, so privileges / grant..... ?

i did pointed out to mariadb cookbook to have workarround old way in this forum, don't know if thos info's and texts from mariadb could help some? https://www.virtualmin.com/node/66717

Fri, 08/02/2019 - 06:32
Baterka

You need to do 2 more things to get it work:

1) Install Perl SHA1 library

root# perl -MCPAN -e shell
cpan> install Digest::SHA1

2) Upgrade MariaDB (Only installing new version is not enough!)

root# mysql_upgrade

3) Then do change in feature-mysql.pl

Fri, 08/02/2019 - 16:21 (Reply to #12)
Christos_Tzeremes

Thanks Baterka i think Digest::SHA1 was default by Perl but you have right !!!

Christos Tzeremes IT Expert @ nasa.gr Thessalonikh GREECE [MACEDONIA] ctzeremes[at]nasa.gr

Fri, 08/02/2019 - 08:20
Jfro

don't want SHA1 anymore!

So hopes virtualmin is solving this "BUG" soon. ;)

Fri, 08/02/2019 - 09:35
andreychek

Jamie is indeed working on this, we hope to be issuing a new Webmin version soon that handles newer MariaDB versions!

I did point him to this thread, he said there's a handful of other things that need tweaked as well.

We'll make a post as soon as this is corrected, thanks for posting an interim solution here!

-Eric

Fri, 08/02/2019 - 09:56 (Reply to #15)
applejack

Hi andreychek

So what is the latest version of MariaDB currently supported ? 10.1 ?

Fri, 08/02/2019 - 16:39
Christos_Tzeremes

There are and ONE MORE SOLUTION but everything is manual in that situation ....

  1. You must create everything in mysql or phpmyadmin ... [user, databases ... etc .. etc....]

  2. And you must find the domain ID file in this folder /etc/webmin/virtual-server/domains/ and must add or correct this values on file (search and change or add them) ...
    *(You can find domain ID in virtualmin by selecting the domain you want and select Edit Virtual Server the domain ID is in Virtual server details under IP addresses...)

mysql_module=mysql << You must put mysql if missing

mysql=1 << This enable the database in Virtualmin panel must be 1

db_mysql=DB NAME << Change to your DB name

limit_mysql=0 << Limit of mysql databases on domain (0 for unlimited or whatever you want)

mysql_user=MYSQL USER << Change to your MySQL Database user name

mysql_pass=MYSQL USER PASS << Change to your MySQL Database user password

Best regards to all

Christos Tzeremes IT Expert @ nasa.gr Thessalonikh GREECE [MACEDONIA] ctzeremes[at]nasa.gr

Tue, 08/06/2019 - 20:41
landshark

I am getting an error message when I try this quickfix.

If I try to create a new server this is what shows up in the advanced tab (the other tabs do not show):

HTTP/1.0 500 Perl execution failed Server: MiniServ/1.921 Date: Wed, 7 Aug 2019 01:36:58 GMT Content-type: text/html; Charset=iso-8859-1 Connection: close Error - Perl execution failed Undefined subroutine &virtual_server::list_remote_mysql_modules called at /usr/libexec/webmin/virtual-server/domain_form.cgi line 439.

If I try to edit a virtual server to add MySql I get the following error:

500 - Error - Perl execution failed Undefined subroutine &virtual_server::list_dom_mysql_databases called at /usr/libexec/webmin/virtual-server/feature-mysql.pl line 1419.
Wed, 08/07/2019 - 13:22 (Reply to #18)
landshark

I should probably add that I am using CentOS 7 and MariaDB 10.3

Wed, 08/07/2019 - 22:25
manchego

Can someone please translate the "quick fix" into usable commands, please? I didn't have this problem before the latest Virtualmin update and my MariaDB version hasn't changed (10.3)

However, I'm unable to create a new virtual server at the moment

Thu, 08/08/2019 - 20:55
landshark

This is frustrating, I have tried this fix over and over and cannot get it to work. I assume I am doing it correctly but as @manchego noted it is quite confusing and had to know if I am doing it correctly.

Are there any other solutions out there?

Thu, 08/08/2019 - 23:48
alnork
alnork's picture

i ran this tweak and worked for me ;) https://help.directadmin.com/item.php?id=690

Alnork

Fri, 08/09/2019 - 04:25 (Reply to #22)
liviu24

Not working for me, I hope an official fix is comming soon

Fri, 08/09/2019 - 05:22
Jfro

For all please post in every post: working not working also versions and OS.

Make it more easy for Support here. ;) Scrolling searching for is.........

Sun, 08/18/2019 - 00:36
alyjack

Please be aware this fix working only for MariaDB v10.4 and make sure 'gcc' is installed before you install Perl SHA1 library. root# yum install gcc