Drop multiple databases?
am 14.12.2006 03:18:58 von John Sherling
I'm using 4.1.13a of mysql. Want to know if there's an easy way to dro
pall databases that share a common prefix, using a single command. So
if my databases are:
uesr1_coolDB1
user1_another_db_2
user1_db3
I'd like to be able to drop them all with something like:
DROP DATABASE user1_*;
Possible? Other ways to do the same thing?
Many thanks...
Re: Drop multiple databases?
am 14.12.2006 09:35:17 von que
no
John Sherling íàïèñà=E2:
> I'm using 4.1.13a of mysql. Want to know if there's an easy way to dro
> pall databases that share a common prefix, using a single command. So
> if my databases are:
>
> uesr1_coolDB1
> user1_another_db_2
> user1_db3
>
> I'd like to be able to drop them all with something like:
>
> DROP DATABASE user1_*;
>=20
> Possible? Other ways to do the same thing?
>=20
> Many thanks...
Re: Drop multiple databases?
am 14.12.2006 22:50:57 von Aggro
John Sherling wrote:
> I'm using 4.1.13a of mysql. Want to know if there's an easy way to dro
> pall databases that share a common prefix, using a single command. So if
> my databases are:
>
> uesr1_coolDB1
> user1_another_db_2
> user1_db3
>
> I'd like to be able to drop them all with something like:
>
> DROP DATABASE user1_*;
>
> Possible? Other ways to do the same thing?
Not possible, but you could create a script that would first query
tablenames, separate those you want to and create delete queries and
execute them. It isn't that hard if you are working on Linux or similar
platform and are experienced programmer, but if you are talking about
20-50 tables, just do "show tables", copy-paste the result to an text
editor and use search&replace to create delete queries and copy-paste
back to console to execute.