phpMyAdmin: Export Databases as Separate Files: Named as Numbers?

Inside phpMyAdmin, I know how to go the the ‘Export’ tab, use ‘Save Output to a File’. A have used
and am aware of the ‘Export Databases as Separate Files’ option, and do see the ‘File Name Template’ text area.

If I end up exporting a database with a larger amount of separate files, how can I get phpMyAdmin to use numbers for the file names, starting from zero(0) and just counting and naming upwards, +1, for every next filename? If it is possible to put something into the ‘File Name Template’ to do this, can someone please reply with a working example of that, which will just number separate files starting from 1 and counting ever upwards, kindly, please?

I’m not familiar with that function of phpMyAdmin. And I just tried it in our phpMyAdmin setup, and it didn’t even seem to work. It just opened a new tab for me with no URL in the address bar and no file being downloaded.

I would assume the “File Name Template” is only for the name of the archive, not for the name of the files inside the archive. If you tick the “Export Tables as Separate Files” option, I would expect the contents of the archive to have a separate file for each table, with the file name being the table name.

The template itself seems to support these variables: FAQ - Frequently Asked Questions — phpMyAdmin 5.1.4 documentation No counters there.

I also do wonder why you would want the files to be numbered. The only situation where I would want that is if I wanted to split the contents of an individual table. But I don’t think phpMyAdmin can do that, and I don’t know of any tool that can.

4 Likes

It turns out that if I am doing a phpMyAdmin database import which is to do with WordPress Hosting, they can tend to have an upper limit for the database file. While the maximum that I have is more than enough below the Hosting database import limit of 300 MB, it has struck me that this is just one .sql file at a time. I have gotten the file splitting ber separate table thing working successfully, and of course you get can’t repeat table names out of a database. It’s just that if I had lots of smaller files, it would be more useful and reliable if they were all uniquely numbers starting from 1 up. I could use the graphical file browser to sort them visually for me instantly, and if I was importing groups of files, then their names being numbers could immensely help the process, if, for example, I imported ten (10) files at a time, and just kept going down a numbered list of files in the dialog until finished.

Is there anyone else out there who knows more about this in relation to myPHPAdmin, in terms of the selection filter too, or is this presently impossible to do with database exports via myPHPAdmin at the moment?

Instead of numbering, maybe it would help you if the file contains date/time in the name ?

and then in File name
put something like this

@DATABASE@_%Y%m%d_%H%M%S

or somehow play with it to get what you want

Yes, I had speculated that the exporting file splitting option could work with a name filter that bears it down to the second. The problems are that:

-this doesn’t go down to the milllisecond.

-that even if it did, there isn’t any total proof that two split files could be finished within one (1) millisecond.
If anyone could find a way to increasingly number the names of these export files, so that each split file is required to always be unique, it would be the best thing to do.

Otherwise, I suppose I can make use of unique file names per required unique table names, and sorting by filename in my file browser, and being careful about where I put and keep my select cursor to track where I am uploading through a large group of files. Thanks anyways!

All tools I know that can export a database with separate files per table create file names matching the table name. That’s generally a more useful format for a backup, because you may only want to restore some of the tables for testing, in which case it’s easy to find those tables through the file names.

I think that’s the best option. And to be honest, I don’t see how having numbered files will help. In either case you can sort the files by name and will have to keep track of which files you uploaded and which you didn’t.

The table names in the file might actually be an advantage here. If you upload a file twice, it’s generally harmless because either the import will fail or just recreate the table. But if you have the files of, say, 50 tables and after finishing the restore you only have 49 tables, it’s a lot easier to find the table you missed if you can compare the table names in the restored database with the named files.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.