温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

phpmyadmin怎么配置

发布时间:2021-11-06 13:33:13 来源:亿速云 阅读:228 作者:小新 栏目:MySQL数据库

小编给大家分享一下phpmyadmin怎么配置,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

开启记录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';

看完了这篇文章,相信你对“phpmyadmin怎么配置”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI