next up previous contents
Next: Network Up: Moodle 移機 Previous: Moodle 移機   Contents

Moodle 設定

  1. 修改 Moodle 設定檔上的網頁根路徑。
    [root@moodle ~]# vim /var/www/html/moodle23/config.php
    $CFG->wwwroot   = '';
    $CFG->dataroot  = '/var/www/moodledata23';
  2. Moodle 密碼並不單是將密碼加密後,存入 MySQL 資料庫,還包含一串存於設定檔中的亂數。移機後原密碼可能無法使用,可以登入 mysql 重新設定。
    [root@moodle ~]# grep password /var/www/html/moodle23/config.php
    $CFG->passwordsaltmain = 'passwordsaltmain';
    [root@moodle ~]# mysql -uroot -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 93
    Server version: 5.1.69 Source distribution
    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    mysql> use moodle23;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed
    mysql> UPDATE mdl_user SET password = MD5(CONCAT('newpassword', 'passwordsaltmain')) WHERE id=2;
    Query OK, 0 rows affected (0.01 sec)
    Rows matched: 1  Changed: 0  Warnings: 0
    mysql> exit