phpmyadmin 的配置 可实现记录即使操作,登陆管理多个DB等

开启记录history的参数是以下这个,当设置为true后就能将用户操作的sql记录在配合pmyadmin的pma_history中
$ cfg [ 'QueryHistoryDB' ]   =   'true' ;   //enable phpmyadmin record user sql


点击(此处)折叠或打开


  1. <?php
  2. /**
  3.  * Debian local configuration file
  4.  *
  5.  * This file overrides the settings made by phpMyAdmin interactive setup
  6.  * utility.
  7.  *
  8.  * For example configuration see
  9.  * /usr/share/doc/phpmyadmin/examples/config.sample.inc.php
  10.  * or
  11.  * /usr/share/doc/phpmyadmin/examples/config.manyhosts.inc.php
  12.  *
  13.  * NOTE: do not add security sensitive data to this file (like passwords)
  14.  * unless you really know what you're doing. If you do, any user that can
  15.  * run PHP or CGI on your webserver will be able to read them. If you still
  16.  * want to do this, make sure to properly secure the access to this file
  17.  * (also on the filesystem level).
  18.  */

  19. if (!function_exists('check_file_access')) {
  20.     function check_file_access($path)
  21.     {
  22.      if (is_readable($path)) {
  23.         return true;
  24.      } else {
  25.         error_log(
  26.          'phpmyadmin: Failed to load ' . $path
  27.          . ' Check group www-data has read access and open_basedir restrictions.'
  28.         );
  29.         return false;
  30.      }
  31.     }
  32. }

  33. // Load secret generated on postinst
  34. if (check_file_access('/var/lib/phpmyadmin/blowfish_secret.inc.php')) {
  35.     require('/var/lib/phpmyadmin/blowfish_secret.inc.php');
  36. }

  37. // Load autoconf local config
  38. if (check_file_access('/var/lib/phpmyadmin/config.inc.php')) {
  39.     require('/var/lib/phpmyadmin/config.inc.php');
  40. }

  41. /**
  42.  * Server(s) configuration
  43.  */
  44. $i = 0;
  45. // The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0].
  46. // You can disable a server config entry by setting host to ''.
  47. $i++;

  48. /**
  49.  * Read configuration from dbconfig-common
  50.  * You can regenerate it using: dpkg-reconfigure -plow phpmyadmin
  51.  */
  52. if (check_file_access('/etc/phpmyadmin/config-db.php')) {
  53.     require('/etc/phpmyadmin/config-db.php');
  54. }

  55. /* Configure according to dbconfig-common if enabled */
  56. if (!empty($dbname)) {
  57.     /* Authentication type */
  58.     $cfg['Servers'][$i]['auth_type'] = 'cookie';
  59.     /* Server parameters */
  60.     if (empty($dbserver)) $dbserver = 'localhost';
  61.     $cfg['Servers'][$i]['host'] = $dbserver;

  62.     if (!empty($dbport) || $dbserver != 'localhost') {
  63.         $cfg['Servers'][$i]['connect_type'] = 'tcp';
  64.         $cfg['Servers'][$i]['port'] = $dbport;
  65.     }
  66.     //$cfg['Servers'][$i]['compress'] = false;
  67.     /* Select mysqli if your server has it */
  68.     $cfg['Servers'][$i]['extension'] = 'mysqli';
  69.     /* Optional: User for advanced features */
  70.     $cfg['Servers'][$i]['controluser'] = $dbuser;
  71.     $cfg['Servers'][$i]['controlpass'] = $dbpass;

  72.     $cfg['QueryHistoryDB'] = 'true'; //enable phpmyadmin record user sql
  73.     //$cfg['QueryHistoryMax'] = '100'; //specify the amount of saved history sql
  74.     // Allow connection to server name ending with -mysql:
  75.     $cfg['ArbitraryServerRegexp'] = '@^[^:]\-mysql$@';
  76.     /* Optional: Advanced phpMyAdmin features */
  77.     $cfg['Servers'][$i]['pmadb'] = $dbname;
  78.     $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
  79.     $cfg['Servers'][$i]['relation'] = 'pma__relation';
  80.     $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
  81.     $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
  82.     $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
  83.     $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
  84.     $cfg['Servers'][$i]['history'] = 'pma__history';
  85.     $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
  86.     $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
  87.     $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
  88.     $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
  89.     $cfg['Servers'][$i]['recent'] = 'pma__recent';
  90.     
  91.     /* Uncomment the following to enable logging in to passwordless accounts,
  92.      * after taking note of the associated security risks. */
  93.     // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

  94.     /* Advance to next server for rest of config */
  95.     $i++;
  96. }

  97. /* Server: XXXXXX.com,1234 [1] */
  98. $i++;
  99. $cfg['Servers'][$i]['verbose'] = 'XXXXXX.com,1234';
  100. $cfg['Servers'][$i]['host'] = 'XXXXXX.com';
  101. $cfg['Servers'][$i]['port'] = 1234;
  102. $cfg['Servers'][$i]['socket'] = '';
  103. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  104. $cfg['Servers'][$i]['extension'] = 'mysql';
  105. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  106. $cfg['Servers'][$i]['user'] = '';
  107. $cfg['Servers'][$i]['password'] = '';
  108. $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
  109. $cfg['Servers'][$i]['controluser'] = 'pma';
  110. $cfg['Servers'][$i]['controlpass'] = 'pmapassword';
  111. $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
  112. $cfg['Servers'][$i]['relation'] = 'pma__relation';
  113. $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
  114. $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
  115. $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
  116. $cfg['Servers'][$i]['history'] = 'pma__history';
  117. $cfg['Servers'][$i]['recent'] = 'pma__recent';
  118. $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
  119. $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
  120. $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
  121. $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
  122. $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
  123. $cfg['Servers'][$i]['tracking_version_auto_create'] = true;


  124. $cfg['QueryHistoryDB'] = 'true'; //enable phpmyadmin record user sql
  125. //$cfg['QueryHistoryMax'] = '100'; //specify the amount of saved history sql
  126. /* End of servers configuration */


  127. /* Authentication type */
  128. //$cfg['Servers'][$i]['auth_type'] = 'cookie';
  129. /* Server parameters */
  130. //$cfg['Servers'][$i]['host'] = 'localhost';
  131. //$cfg['Servers'][$i]['connect_type'] = 'tcp';
  132. //$cfg['Servers'][$i]['compress'] = false;
  133. /* Select mysqli if your server has it */
  134. //$cfg['Servers'][$i]['extension'] = 'mysql';
  135. /* Optional: User for advanced features */
  136. // $cfg['Servers'][$i]['controluser'] = 'pma';
  137. // $cfg['Servers'][$i]['controlpass'] = 'pmapass';

  138. /* Storage database and tables */
  139. // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
  140. // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
  141. // $cfg['Servers'][$i]['relation'] = 'pma_relation';
  142. // $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
  143. // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
  144. // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
  145. // $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
  146. // $cfg['Servers'][$i]['history'] = 'pma_history';
  147. // $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
  148. // $cfg['Servers'][$i]['tracking'] = 'pma_tracking';
  149. // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
  150. // $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
  151. // $cfg['Servers'][$i]['recent'] = 'pma_recent';
  152. /* Uncomment the following to enable logging in to passwordless accounts,
  153.  * after taking note of the associated security risks. */
  154. // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

  155. /*
  156.  * End of servers configuration
  157.  */

  158. /*
  159.  * Directories for saving/loading files from server
  160.  */
  161. $cfg['UploadDir'] = '';
  162. $cfg['SaveDir'] = '';

  163. /* Support additional configurations */
  164. foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename)
  165. {
  166.     include($filename);
  167. }
  168. /* Display warning on main page if the MySQL library and server version is diff */
  169. $cfg['ServerLibraryDifference_DisableWarning'] = 'true';

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16131092/viewspace-2133303/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16131092/viewspace-2133303/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值