phpMyAdmin 設定進階功能

Loading

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

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

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

  1. 透過 examples/create_tables.sql 建立必需的資料表.
    CentOS 7

    [root@localhost ~]$ cd /var/www/html/phpMyAdmin
    [root@localhost phpMyAdmin]$ mysql -u root -p < examples/create_tables.sql 
    Enter password: 
    

    CentOS 8

    [root@localhost ~]$ cd /var/www/html/phpMyAdmin
    [root@localhost phpMyAdmin]$ mysql -u root -p < sql/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)]> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.001 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) 設定成為你剛剛設定的值
    CentOS 7

    [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';
    

    CentOS 8

    $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]['userconfig'] = 'pma__userconfig';
    $cfg['Servers'][$i]['recent'] = 'pma__recent';
    $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
    $cfg['Servers'][$i]['users'] = 'pma__users';
    $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
    $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
    $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
    $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
    $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
    $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
    
  4. 請重新登入 phpMyAdmin 以載入新設定並使其生效.

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

沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料