千家信息网

phpmyadmin怎么配置

发表于:2025-02-12 作者:千家信息网编辑
千家信息网最后更新 2025年02月12日,小编给大家分享一下phpmyadmin怎么配置,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!开启记录history的参数是以下这个,当设置为true后就能将用户操作的sql记录在配合
千家信息网最后更新 2025年02月12日phpmyadmin怎么配置

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

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


点击(此处)折叠或打开


  1. /**

  2. * Debian local configuration file

  3. *

  4. * This file overrides the settings made by phpMyAdmin interactive setup

  5. * utility.

  6. *

  7. * For example configuration see

  8. * /usr/share/doc/phpmyadmin/examples/config.sample.inc.php

  9. * or

  10. * /usr/share/doc/phpmyadmin/examples/config.manyhosts.inc.php

  11. *

  12. * NOTE: do not add security sensitive data to this file (like passwords)

  13. * unless you really know what you're doing. If you do, any user that can

  14. * run PHP or CGI on your webserver will be able to read them. If you still

  15. * want to do this, make sure to properly secure the access to this file

  16. * (also on the filesystem level).

  17. */


  18. if (!function_exists('check_file_access')) {

  19. function check_file_access($path)

  20. {

  21. if (is_readable($path)) {

  22. return true;

  23. } else {

  24. error_log(

  25. 'phpmyadmin: Failed to load ' . $path

  26. . ' Check group www-data has read access and open_basedir restrictions.'

  27. );

  28. return false;

  29. }

  30. }

  31. }


  32. // Load secret generated on postinst

  33. if (check_file_access('/var/lib/phpmyadmin/blowfish_secret.inc.php')) {

  34. require('/var/lib/phpmyadmin/blowfish_secret.inc.php');

  35. }


  36. // Load autoconf local config

  37. if (check_file_access('/var/lib/phpmyadmin/config.inc.php')) {

  38. require('/var/lib/phpmyadmin/config.inc.php');

  39. }


  40. /**

  41. * Server(s) configuration

  42. */

  43. $i = 0;

  44. // The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0].

  45. // You can disable a server config entry by setting host to ''.

  46. $i++;


  47. /**

  48. * Read configuration from dbconfig-common

  49. * You can regenerate it using: dpkg-reconfigure -plow phpmyadmin

  50. */

  51. if (check_file_access('/etc/phpmyadmin/config-db.php')) {

  52. require('/etc/phpmyadmin/config-db.php');

  53. }


  54. /* Configure according to dbconfig-common if enabled */

  55. if (!empty($dbname)) {

  56. /* Authentication type */

  57. $cfg['Servers'][$i]['auth_type'] = 'cookie';

  58. /* Server parameters */

  59. if (empty($dbserver)) $dbserver = 'localhost';

  60. $cfg['Servers'][$i]['host'] = $dbserver;


  61. if (!empty($dbport) || $dbserver != 'localhost') {

  62. $cfg['Servers'][$i]['connect_type'] = 'tcp';

  63. $cfg['Servers'][$i]['port'] = $dbport;

  64. }

  65. //$cfg['Servers'][$i]['compress'] = false;

  66. /* Select mysqli if your server has it */

  67. $cfg['Servers'][$i]['extension'] = 'mysqli';

  68. /* Optional: User for advanced features */

  69. $cfg['Servers'][$i]['controluser'] = $dbuser;

  70. $cfg['Servers'][$i]['controlpass'] = $dbpass;


  71. $cfg['QueryHistoryDB'] = 'true'; //enable phpmyadmin record user sql

  72. //$cfg['QueryHistoryMax'] = '100'; //specify the amount of saved history sql

  73. // Allow connection to server name ending with -mysql:

  74. $cfg['ArbitraryServerRegexp'] = '@^[^:]\-mysql$@';

  75. /* Optional: Advanced phpMyAdmin features */

  76. $cfg['Servers'][$i]['pmadb'] = $dbname;

  77. $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';

  78. $cfg['Servers'][$i]['relation'] = 'pma__relation';

  79. $cfg['Servers'][$i]['table_info'] = 'pma__table_info';

  80. $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';

  81. $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';

  82. $cfg['Servers'][$i]['column_info'] = 'pma__column_info';

  83. $cfg['Servers'][$i]['history'] = 'pma__history';

  84. $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';

  85. $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';

  86. $cfg['Servers'][$i]['tracking'] = 'pma__tracking';

  87. $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';

  88. $cfg['Servers'][$i]['recent'] = 'pma__recent';


  89. /* Uncomment the following to enable logging in to passwordless accounts,

  90. * after taking note of the associated security risks. */

  91. // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;


  92. /* Advance to next server for rest of config */

  93. $i++;

  94. }


  95. /* Server: XXXXXX.com,1234 [1] */

  96. $i++;

  97. $cfg['Servers'][$i]['verbose'] = 'XXXXXX.com,1234';

  98. $cfg['Servers'][$i]['host'] = 'XXXXXX.com';

  99. $cfg['Servers'][$i]['port'] = 1234;

  100. $cfg['Servers'][$i]['socket'] = '';

  101. $cfg['Servers'][$i]['connect_type'] = 'tcp';

  102. $cfg['Servers'][$i]['extension'] = 'mysql';

  103. $cfg['Servers'][$i]['auth_type'] = 'cookie';

  104. $cfg['Servers'][$i]['user'] = '';

  105. $cfg['Servers'][$i]['password'] = '';

  106. $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';

  107. $cfg['Servers'][$i]['controluser'] = 'pma';

  108. $cfg['Servers'][$i]['controlpass'] = 'pmapassword';

  109. $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';

  110. $cfg['Servers'][$i]['relation'] = 'pma__relation';

  111. $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';

  112. $cfg['Servers'][$i]['table_info'] = 'pma__table_info';

  113. $cfg['Servers'][$i]['column_info'] = 'pma__column_info';

  114. $cfg['Servers'][$i]['history'] = 'pma__history';

  115. $cfg['Servers'][$i]['recent'] = 'pma__recent';

  116. $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';

  117. $cfg['Servers'][$i]['tracking'] = 'pma__tracking';

  118. $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';

  119. $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';

  120. $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';

  121. $cfg['Servers'][$i]['tracking_version_auto_create'] = true;



  122. $cfg['QueryHistoryDB'] = 'true'; //enable phpmyadmin record user sql

  123. //$cfg['QueryHistoryMax'] = '100'; //specify the amount of saved history sql

  124. /* End of servers configuration */



  125. /* Authentication type */

  126. //$cfg['Servers'][$i]['auth_type'] = 'cookie';

  127. /* Server parameters */

  128. //$cfg['Servers'][$i]['host'] = 'localhost';

  129. //$cfg['Servers'][$i]['connect_type'] = 'tcp';

  130. //$cfg['Servers'][$i]['compress'] = false;

  131. /* Select mysqli if your server has it */

  132. //$cfg['Servers'][$i]['extension'] = 'mysql';

  133. /* Optional: User for advanced features */

  134. // $cfg['Servers'][$i]['controluser'] = 'pma';

  135. // $cfg['Servers'][$i]['controlpass'] = 'pmapass';


  136. /* Storage database and tables */

  137. // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';

  138. // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';

  139. // $cfg['Servers'][$i]['relation'] = 'pma_relation';

  140. // $cfg['Servers'][$i]['table_info'] = 'pma_table_info';

  141. // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';

  142. // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';

  143. // $cfg['Servers'][$i]['column_info'] = 'pma_column_info';

  144. // $cfg['Servers'][$i]['history'] = 'pma_history';

  145. // $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';

  146. // $cfg['Servers'][$i]['tracking'] = 'pma_tracking';

  147. // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';

  148. // $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';

  149. // $cfg['Servers'][$i]['recent'] = 'pma_recent';

  150. /* Uncomment the following to enable logging in to passwordless accounts,

  151. * after taking note of the associated security risks. */

  152. // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;


  153. /*

  154. * End of servers configuration

  155. */


  156. /*

  157. * Directories for saving/loading files from server

  158. */

  159. $cfg['UploadDir'] = '';

  160. $cfg['SaveDir'] = '';


  161. /* Support additional configurations */

  162. foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename)

  163. {

  164. include($filename);

  165. }

  166. /* Display warning on main page if the MySQL library and server version is diff */

  167. $cfg['ServerLibraryDifference_DisableWarning'] = 'true';

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

0