-
-
Save iamphilrae/d538d5b48608de290bfee791df3e6f54 to your computer and use it in GitHub Desktop.
@DATABASE@__%Y-%m-%d_%H-%M-%S |
Very useful, indeed. Thanks 👍
Thank you!
Thanks!
Great tip Thanks!
How do I do it like this?
Database name: test
"test-backup-2018-07-14.sql"
How do I do it like this?
Database name: test
"test-backup-2018-07-14.sql"
@DATABASE@-backup-%Y-%m-%d
Thanks!
The gift that keeps on giving. Thanks mate!
In case you haven't created an export template before, you should do this:
Go to "PHPMyAdmin", select your database, click "Export" on the top menu, enter a name for your template (whatever, you should understand it), click "Custom" under "Export method", scroll down a little bit to reach the "File name template" section, and then enter your template name (like @DATABASE@__%Y-%m-%d_%H-%M-%S
). Then scroll up and click "Create" button (next to the "New template" text input).
That's it.
Thanks, exactly was I was looking for.
the amount of times I keep revisiting this snippet amazes me. thanks!!
Does anyone know if it's possible to include a space character in the exported filename?
Does anyone know if it's possible to include a space character in the exported filename?
Yeah that's no problem at all, just set the format to include the spaces, e.g.
@DATABASE@ %Y-%m-%d %H-%M-%S
This should output a filename of the format:
my-database-name 2020-10-28 17-01-00.sql
Thanks!
Thanks!
Thanks!
Does anyone know why the @DATABASE@
variable would be empty when doing an export?
@SERVER@ @DATABASE@__%Y-%m-%d_%H-%M-%S
results in:
mysql_3306___2022-10-30_02-00-13.sql.gz
Does anyone know why the
@DATABASE@
variable would be empty when doing an export?
@SERVER@ @DATABASE@__%Y-%m-%d_%H-%M-%S
results in:
mysql_3306___2022-10-30_02-00-13.sql.gz
You could give __DB__
a try. I believe it's a legacy variable, and should output the same value as @DATABASE@
, however you never know, may work.
@iamphilrae Thank you. I just gave it a shot, but unfortunately still no luck. :/
According to phpMyAdmin FAQ, @database@ refers to "the currently open database.
But since you are not "in" a database, it is not available.
Doesn't even work when you choose to export each database into its own file.
Weird, but that is phpMyAdmin's choice.
@JorgenBB Ahhhh, ok, that makes some sense, thank you.
It definitely is a strange decision, or perhaps just an oversight if they've never come across the issue themselves? It seems like a pretty easy thing to add, just getting the name of the db as it iterates through the list, and add it to a variable. I'm not much of a coder or I'd try submitting a PR myself. :/
@phpmyadmin team, please add this 'enhancement', I beeeegg you! QOL improvement to the n'th degree! :)
Thanks! ヾ(≧▽≦*)o
Very useful, thanks for sharing!