Annotation of loncom/metadata_database/configure_mysql_db.pl, revision 1.1

1.1     ! matthew     1: #!/usr/bin/perl -w
        !             2: # The LearningOnline Network 
        !             3: # Red Hat 7.3 installation script
        !             4: #
        !             5: # $Id: install.pl,v 1.19 2003/01/12 19:07:28 matthew Exp $
        !             6: #
        !             7: # Copyright Michigan State University Board of Trustees
        !             8: #
        !             9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
        !            10: #
        !            11: # LON-CAPA is free software; you can redistribute it and/or modify
        !            12: # it under the terms of the GNU General Public License as published by
        !            13: # the Free Software Foundation; either version 2 of the License, or
        !            14: # (at your option) any later version.
        !            15: #
        !            16: # LON-CAPA is distributed in the hope that it will be useful,
        !            17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            19: # GNU General Public License for more details.
        !            20: #
        !            21: # You should have received a copy of the GNU General Public License
        !            22: # along with LON-CAPA; if not, write to the Free Software
        !            23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        !            24: #
        !            25: # http://www.lon-capa.org/
        !            26: #
        !            27: 
        !            28: ##
        !            29: ## Set up mysql
        !            30: ##
        !            31: print("Setting mysqld to start on boot up.\n");
        !            32: system("/sbin/chkconfig --add mysqld");
        !            33: system("/sbin/chkconfig mysqld on");
        !            34: print(`/sbin/chkconfig --list mysqld`);
        !            35: 
        !            36: print("mysql links created successfully\n");
        !            37: print(`/etc/rc.d/init.d/mysqld start`);
        !            38: print("Waiting for mysql daemon to start.\n");
        !            39: sleep 5;
        !            40: my $status = system("/etc/rc.d/init.d/mysqld status");
        !            41: if ($status != 0) {
        !            42:     die "Unable to start mysql daemon\nHalting\n";
        !            43: } else {
        !            44:     print("Mysql daemon is running.\n");
        !            45: }
        !            46: print("\n");
        !            47: 
        !            48: ##
        !            49: ## Get root password for mysql client
        !            50: ##
        !            51: print <<END;
        !            52: Please enter a root password for the mysql database.
        !            53: It does not have to match your root account password, but you will need
        !            54: to remember it.
        !            55: END
        !            56: my $rootpass = <>;
        !            57: chomp $rootpass;
        !            58: print("\n");
        !            59: 
        !            60: ##
        !            61: ## Run the damn thing (mysql, not LON-CAPA)
        !            62: ##
        !            63: print("Starting mysql client.\n");
        !            64: open MYSQL, "|mysql -u root mysql" || die "Unable to start mysql\n";
        !            65: print MYSQL <<"ENDMYSQL";
        !            66: CREATE DATABASE loncapa;
        !            67: INSERT INTO user (Host, User, Password)
        !            68: VALUES ('localhost','www',password('localhostkey'));
        !            69: INSERT INTO db VALUES ('localhost','loncapa','www',
        !            70: 'Y','Y','Y','Y','Y','Y','N','Y','Y','Y');
        !            71: SET PASSWORD FOR root\@localhost=PASSWORD('$rootpass');
        !            72: DELETE FROM user WHERE host<>'localhost';
        !            73: FLUSH PRIVILEGES;
        !            74: USE loncapa;
        !            75: CREATE TABLE IF NOT EXISTS metadata (title TEXT, author TEXT, subject TEXT, url TEXT, keywords TEXT, version TEXT, notes TEXT, abstract TEXT, mime TEXT, language TEXT, creationdate DATETIME, lastrevisiondate DATETIME, owner TEXT, copyright TEXT, FULLTEXT idx_title (title), FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), FULLTEXT idx_version (version), FULLTEXT idx_notes (notes), FULLTEXT idx_abstract (abstract), FULLTEXT idx_mime (mime), FULLTEXT idx_language (language), FULLTEXT idx_owner (owner), FULLTEXT idx_copyright (copyright)) TYPE=MYISAM;
        !            76: EXIT
        !            77: ENDMYSQL
        !            78: 
        !            79: close MYSQL;
        !            80: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>