860 瀏覽數

phpMyAdmin 設定進階功能

安裝完的 phpMyAdmin 在首頁都會顯示 尚未設定 phpmyadmin 資料庫 某些進階功能將無法使用.

查了一下 phpMyAdmin 的進階功能 bookmarks, comments, SQL-history, tracking mechanism, PDF-generation, column contents transformation, etc.

設定也不難,只需要按照下面的方式來設定 ,測試環境為 CentOS 7 x86_64
快速設定進階功能:

  1. 透過 examples/create_tables.sql 建立必需的資料表.
    [root@localhost ~]$ cd /var/www/html/phpMyAdmin
    [root@localhost phpMyAdmin]$ mysql -u root -p < examples/create_tables.sql 
    Enter password: 
    
  2. 建立一個 pma 使用者並授權存取上一步操作中所建立的資料表的權限.
    [root@localhost phpMyAdmin]$ mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 36
    Server version: 5.5.52-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> CREATE USER pma@localhost IDENTIFIED BY '111111';
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON phpmyadmin.* TO pma@localhost;
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [(none)]> quit;
    Bye
    
  3. 在設定檔 (config.inc.php) 中啓用進階功能,請參考 config.sample.inc.php 中的範例.
    [root@localhost phpMyAdmin]$ cp config.sample.inc.php config.inc.php
    

    去掉以下區塊的註解,並將 controluser ( pma ) 與 controlpass (111111) 設定成為你剛剛設定的值

    [root@localhost phpMyAdmin]$ vi config.inc.php
    
    /*
     * phpMyAdmin configuration storage settings.
     */
    
    /* User used to manipulate with storage */
    //$cfg['Servers'][$i]['controlhost'] = '';
    $cfg['Servers'][$i]['controluser'] = 'pma';
    $cfg['Servers'][$i]['controlpass'] = '111111';
    
    /* Storage database and tables */
    $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
    $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma__relation';
    $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
    $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
    $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
    $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
    $cfg['Servers'][$i]['history'] = 'pma__history';
    $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
    $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
    $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
    $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
    $cfg['Servers'][$i]['recent'] = 'pma__recent';
    
  4. 請重新登入 phpMyAdmin 以載入新設定並使其生效.

步驟一與二是可以透過 phpMyAdmin 來設定,這邊就不在說明.

發表迴響