473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Drop multiple databases?

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...

Dec 14 '06 #1
2 19116
que
no

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...
Dec 14 '06 #2
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.
Dec 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: M A Srinivas | last post by:
Hello, I would like to know is it possible to disable drop database for sa or sysadmin. If saor sysadmin needs to drop the database , he/she may have to change status in one of the system...
0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
3
by: rallykarro | last post by:
Hi, How do I at the best way perform select statements over multiple databases? I have a couple of databases containing the same table definitions with diffrent data. Now I want them to act...
9
by: TC | last post by:
I need to design a system which represents multiple "projects" in SQL Server. Each project has the same data model, but is independent of all others. My inclination is to use one database to store...
1
by: pagelogix | last post by:
I'm looking for a way to drop multiple tables at the same time from my access database. Any ideas? Thanks.
3
by: scott | last post by:
Hello all, I am ripping my hair out over this and maybe someone could help. I have a site that has groups and subgroups of those groups that all have int id's. I am trying to have a...
6
by: GregG | last post by:
Greetings, I've inherited a project which requires the use of multiple Access databases, each containing a dozen or so tables each. I need to perform queries which included relations and results...
1
by: cvalarmathi | last post by:
Hi Friends, How to drop all databases in one query.I don't know.If anybody know the answer please reply me.....
1
by: richard.crosh | last post by:
What is the IBM recommendation for the number of DB2-LUW databases per instance on AIX? With Oracle, it is one-to-one. In DB2 multiple databases can co-exist in an instance but is this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.