How to change default export settings in phpMyAdmin
March 7, 2021
phpMyAdmin has handy tools for exporting databases or individual tables. All this can be done in the web interface without using the command line.
To export a table, click on its name on the left side of the phpMyAdmin window, and then go to the “Export” tab.
A window with two export methods will be shown:
- Quick - display only the minimal options
- Custom - display all possible options
By default, “Quick” is selected and if you press the “Go” button, the file with the database in SQL format without compression will be downloaded.
I think many people have their preferred database export settings, which they change by switching to the “Custom” export option.
For example, with each export, I choose compression for the database, since the size of the databases decreases significantly. This helps to download and upload databases to servers faster, as well as bypass PHP restrictions on the size of the processed file.
I thought, why not make compression (or any other setting you need) the default option, so that without switching to the “Custom” export method, download a table or database with one click?
It turned out to be quite simple!
Go to the export tab and click that gear in the corner:
A window will open in which you can set any default settings. For example, I chose to use zip compression by default. When everything is ready, click the “Apply” button.
That's all! Now every time you export a database or table to phpMyAdmin it will be compressed into an archive, or any other default settings of your choice will be applied.
Related articles:
- “Failed - Network error” when exporting from phpMyAdmin (SOLVED) (100%)
- How to rename a table in phpMyAdmin and MySQL (100%)
- Password and unix_socket authentication in MySQL and MariaDB. Error “#1698 - Access denied for user ‘root’@’localhost’” (SOLVED) (90.7%)
- How to install a web server (Apache, PHP, MySQL, phpMyAdmin) on Linux Mint, Ubuntu and Debian (90.7%)
- ERROR at line 1: Unknown command '\-'. (SOLVED) (89.6%)
- How to repair an LVM disk using fsck (RANDOM - 50%)
I found that you cannot adjust the default export settings from the export page, so I added some JS code to the end of export.twig. The location of where to place the code may vary in different PHPMyAdmin versions.
<script>
$('#radio_custom_export').prop('checked', true);
$('#radio_view_as_text').prop('checked', true);
$('#checkbox_sql_auto_increment').prop('checked', false);
$('#checkbox_sql_include_comments').prop('checked', false);
$('#checkbox_sql_truncate').prop('checked', true);
$('#checkbox_sql_drop_table').prop('checked', true);
</script>
You can modify the above checks, or add others to your needs.