I want to search in all fields from all tables of a MySQL database a given string, possibly using syntax as:
SELECT * FROM * WHERE * LIKE '%stuff%'
Is it possible to do something like this?
I want to search in all fields from all tables of a MySQL database a given string, possibly using syntax as:
SELECT * FROM * WHERE * LIKE '%stuff%'
Is it possible to do something like this?
This solution
a) is only MySQL, no other language needed, and
b) returns SQL results, ready for processing!
This is the simple way that's i know. Select your DB in PHPMyAdmin, and go to the "Search" tab and write what you want to find and where you will searching for. Select all tables if you will search the words from all tables. Then "GO" and look the result.
You can use this project: http://code.google.com/p/anywhereindb
This will search all the data in all table.
If you are avoiding
stored procedures
like the plague, or are unable to do amysql_dump
due to permissions, or running into other various reasons.I would suggest a three-step approach like this:
1) Where this query builds a bunch of queries as a result set.
.
.
Results should look like this:
2) You can then just
Right Click
and use theCopy Row (tab separated)
3) Paste results in a new query window and run to your hearts content.
Detail: I exclude system schema's that you may not usually see in your workbench unless you have the option
Show Metadata and Internal Schemas
checked.I did this to provide a quick way to
ANALYZE
an entire HOST or DB if needed, or to runOPTIMIZE
statements to support performance improvements.I'm sure there are different ways you may go about doing this but here’s what works for me:
Cheers, Jay ;-]
There is a nice library for reading all tables, ridona