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

raeburn raeburn at source.lon-capa.org
Wed May 4 23:03:58 EDT 2016


raeburn		Thu May  5 03:03:58 2016 EDT

  Modified files:              
    /doc/install/linux	install.pl 
  Log:
  - Support MySQL 5.7.6 
  
  
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.35 doc/install/linux/install.pl:1.36
--- doc/install/linux/install.pl:1.35	Fri Jan  2 13:34:08 2015
+++ doc/install/linux/install.pl	Thu May  5 03:03:57 2016
@@ -72,7 +72,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.35 2015/01/02 13:34:08 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.36 2016/05/05 03:03:57 raeburn Exp $'."\n";
 }
 
 #
@@ -1780,8 +1780,15 @@
 
 sub setup_mysql_permissions {
     my ($dbh,$has_pass, at mysql_lc_commands) = @_;
-    my $mysqlversion = &get_mysql_version();
-    my @mysql_commands = ("INSERT user (Host, User, Password) VALUES('localhost','www',password('localhostkey'));");
+    my ($mysqlversion,$mysqlsubver) = &get_mysql_version();
+    my ($usesauth, at mysql_commands);
+    if (($mysqlversion > 5.7) || (($mysqlversion == 5.7) && ($mysqlsubver > 5))) {
+        @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject) VALUES('localhost','www','','','')",
+                           "ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'");
+        $usesauth = 1;
+    } else {
+        @mysql_commands = ("INSERT user (Host, User, Password) VALUES('localhost','www',password('localhostkey'));");
+    }
     if ($mysqlversion < 4) {
         push (@mysql_commands,"
 INSERT db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) VALUES('localhost','loncapa','www','Y','Y','Y','Y','Y','Y','N','Y','Y','Y')");
@@ -1862,23 +1869,28 @@
 }
 
 sub new_mysql_rootpasswd {
-    my ($currmysqlpass) = @_;
-    return ("SET PASSWORD FOR 'root'\@'localhost'=PASSWORD('$currmysqlpass')",
-            "FLUSH PRIVILEGES;");
+    my ($currmysqlpass,$usesauth) = @_;
+    if ($usesauth) {
+        return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'",
+                "FLUSH PRIVILEGES;");
+    } else {
+        return ("SET PASSWORD FOR 'root'\@'localhost'=PASSWORD('$currmysqlpass')",
+                "FLUSH PRIVILEGES;");
+    }
 }
 
 sub get_mysql_version {
-    my $version;
+    my ($version,$subversion);
     if (open(PIPE," mysql -V |")) {
         my $info = <PIPE>;
         chomp($info);
         close(PIPE);
-        ($version) = ($info =~ /(\d+\.\d+)\.\d+[\-\w]*,/);
+        ($version,$subversion) = ($info =~ /(\d+\.\d+)\.(\d+)[\-\w]*,/);
     } else {
         print &mt('Could not determine which version of MySQL is installed.').
               "\n";
     }
-    return $version;
+    return ($version,$subversion);
 }
 
 ###########################################################




More information about the LON-CAPA-cvs mailing list