Problem Description: Because the company online server and online is completely separate, but sometimes online environment testing or troubleshooting also need to view the database on the line, so here they built a phpmyadmin springboard machine, through the platform can connect the read-only library on the line, but recently received feedback from colleagues, Look at the table records of the library, found that the operation is very card, especially when browsing the table under the library, while the online read-only library has a session in the select COUNT (*) from Tbname, the host IP is the phpMyAdmin server, here to understand, look at the table under the library, phpMyAdmin will show the number of table rows, this operation seriously drag the phpMyAdmin response, but also asked Baidu and Google, but for the table data too much caused by the phpMyAdmin response is not very good solution, so I groped for a bit, Try to modify the source code of phpMyAdmin, so the solution here is to modify the phpMyAdmin source code, the ' SELECT COUNT (*) from tbname ' SQL rewrite.
Above has outlined the problem, now straight to the topic, said how to modify the phpMyAdmin source code to solve the problem.
Basic Environment:
Operating system: Centos 6.5 x64 bit
phpMyAdmin version: Ver 4.4.15.8
MySQL version: all 5.6.33
The first step: since we know it is due to the number of table rows, open the Table.class.php (phpmyadmin/libraries/table.class.php) file:
Find the function ' static public function Countrecords ' in the file, modify the content around 581 lines
The original SQL is as follows:
' SELECT COUNT (*) from '. Pma_util::backquote ($DB). ‘.‘ . Pma_util::backquote ($table)
Because the fields that query the INFORMATION_SCHEMA table are varchar types, you need to add single quotes to the field value, so the modified SQL is as follows:
' SELECT table_rows from INFORMATION_SCHEMA. TABLES where table_schema = \ '. Pma_util::backquote ($DB). ' \ ' and table_name = \ '. Pma_util::backquote ($table). ‘\‘‘
Step Two: Save the exit and restart your Web service Apache or Nginx.
The third step: Login phpMyAdmin, browse the library under the table, directly seconds open, completely non-lag phenomenon.
Note: However, the number of tables seen under the library, except for more than 50W lines of the display number of rows, the remaining table rows are 0, at this time due to the $cfg in libraries/config.default.php [' maxexactcount '] = 500000 parameter settings, if you must display the correct number of table rows, you can set this parameter to 50000 or lower.
This article is from the "Starry Souls" blog, please be sure to keep this source http://mysqldba.blog.51cto.com/6728219/1915694
A solution to the problem of using phpMyAdmin to browse the library structure