phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the Web, it’s a very popular tool included with many server control panels such as Plesk and cPanel. Recently an incident was sent my way where a large customer was advising the ability to export single MySQL tables within PhpMyAdmin was no longer providing the expected SQL format by default. In fact, the SQL format for table export was gone entirely in the drop down menu and the default was now ‘CodeGen’. To be honest, I don’t think I’ve ever exported in this manner, always used mysqldump for databases or tables, BUT if it worked before there’s no reason it should not work now, so let’s check it out.
Issue:
In PhpMyAdmin, selecting a database and then a single table, then going to Export yields the dialog below, with the SQL format missing and defaulting to CodeGen. Cannot export a single table to SQL format any more.
Resolution:
Ah yes, after some digging this is indeed a bug documented a few weeks ago affecting PhpMyAdmin version 4.8.4. Export to SQL Format Not Available for Tables.
The 4.8.4 version of PhpMyAdmin was a recent Security Release from 11 December 2018.
The fix is quite simple, just replace or edit a single file. Fix# 14775 – Export to SQL Format Not Available for Tables
The run down:
1. Connect to the server via SSH. 2. Open file /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/classes/Display/Export.php with you favorite editor. Note: for Windows, it will be %plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\libraries\classes\Display\Export.php. 3. Find line "/* Scan for plugins */" (around line 662 for reference) 4. Add the following above the line: // Export a single table if (isset($_GET['single_table'])) { $GLOBALS['single_table'] = $_GET['single_table']; } 5. Save the file.
After that the SQL format option is available once again !