[LON-CAPA-cvs] cvs: doc /install/linux install.pl

raeburn raeburn at source.lon-capa.org
Tue Feb 19 14:03:43 EST 2019


raeburn		Tue Feb 19 19:03:43 2019 EDT

  Modified files:              
    /doc/install/linux	install.pl 
  Log:
  - Support both Mariadb 10.2 and newer, and MySQL 5.7.6 and newer.
  
  
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.49 doc/install/linux/install.pl:1.50
--- doc/install/linux/install.pl:1.49	Fri Oct 26 17:49:14 2018
+++ doc/install/linux/install.pl	Tue Feb 19 19:03:42 2019
@@ -77,7 +77,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.49 2018/10/26 17:49:14 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.50 2019/02/19 19:03:42 raeburn Exp $'."\n";
 }
 
 #
@@ -2368,8 +2368,9 @@
 sub setup_mysql_permissions {
     my ($dbh,$has_pass, at mysql_lc_commands) = @_;
     my ($mysqlversion,$mysqlsubver,$mysqlname) = &get_mysql_version();
-    my ($usesauth,$hasauthcol, at mysql_commands);
+    my ($usesauth,$is_mariadb,$hasauthcol, at mysql_commands);
     if ($mysqlname =~ /^MariaDB/i) {
+        $is_mariadb = 1;
         if ($mysqlversion >= 10.2) {
             $usesauth = 1;
         } elsif ($mysqlversion >= 5.5) {
@@ -2383,8 +2384,12 @@
         }
     }
     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 {
@@ -2439,7 +2444,7 @@
             }
         }
         if ($got_passwd) {
-            my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth);
+            my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth,$is_mariadb);
             push(@mysql_commands, at newpass_cmds);
         } else {
             print_and_log(&mt('Failed to get MySQL root password from user input.')."\n");
@@ -2469,10 +2474,15 @@
 }
 
 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 WITH mysql_native_password BY '$currmysqlpass'",
+                    "FLUSH PRIVILEGES;");
+        } else {
+            return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'",
+                    "FLUSH PRIVILEGES;");
+        }
     } else {
         return ("SET PASSWORD FOR 'root'\@'localhost'=PASSWORD('$currmysqlpass')",
                 "FLUSH PRIVILEGES;");




More information about the LON-CAPA-cvs mailing list