--- doc/install/linux/install.pl 2019/02/16 16:19:11 1.45.2.1 +++ doc/install/linux/install.pl 2019/02/19 19:24:28 1.45.2.2 @@ -75,7 +75,7 @@ if (!open(LOG,">>loncapa_install.log")) &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.45.2.1 2019/02/16 16:19:11 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.45.2.2 2019/02/19 19:24:28 raeburn Exp $'."\n"; } # @@ -1953,8 +1953,9 @@ CREATE TABLE IF NOT EXISTS metadata (tit sub setup_mysql_permissions { my ($dbh,$has_pass,@mysql_lc_commands) = @_; my ($mysqlversion,$mysqlsubver,$mysqlname) = &get_mysql_version(); - my ($usesauth,$hasauthcol,@mysql_commands); + my ($usesauth,$is_mariadb,$hasauthcol,@mysql_commands); if ($mysqlname =~ /^MariaDB/i) { + $is_mariadb = 1; if ($mysqlversion >= 10.2) { $usesauth = 1; } elsif ($mysqlversion >= 5.5) { @@ -1968,8 +1969,12 @@ sub setup_mysql_permissions { } } if ($usesauth) { - @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')", - "ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')"); + if ($is_mariadb) { + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + } else { + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); + } } elsif ($hasauthcol) { @mysql_commands = ("INSERT user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www',password('localhostkey'),'','','','');"); } else { @@ -2024,7 +2029,7 @@ INSERT db (Host,Db,User,Select_priv,Inse } } if ($got_passwd) { - my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth); + my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth,$is_mariadb); push(@mysql_commands,@newpass_cmds); } else { print_and_log(&mt('Failed to get MySQL root password from user input.')."\n"); @@ -2054,10 +2059,15 @@ INSERT db (Host,Db,User,Select_priv,Inse } sub new_mysql_rootpasswd { - my ($currmysqlpass,$usesauth) = @_; + my ($currmysqlpass,$usesauth,$is_mariadb) = @_; if ($usesauth) { - return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", - "FLUSH PRIVILEGES;"); + if ($is_mariadb) { + return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", + "FLUSH PRIVILEGES;"); + } else { + return ("ALTER USER 'root'\@'localhost' IDENTIFIED WITH mysql_native_password BY '$currmysqlpass'", + "FLUSH PRIVILEGES;"); + } } else { return ("SET PASSWORD FOR 'root'\@'localhost'=PASSWORD('$currmysqlpass')", "FLUSH PRIVILEGES;");