Night Walker
Night Walker

Reputation: 21280

Search for string in all tables

Is there some tool that can do that ?

Searching for given string in whole database ?

Upvotes: 2

Views: 231

Answers (2)

Dustin E
Dustin E

Reputation: 368

You could query the metadata to find all of the tables and columns within the tables and then search each of them for the string.

Here's some links on how to pull the metadata out of mysql:

http://www.developerfusion.com/code/3945/get-metadata-on-mysql-databases/ http://forge.mysql.com/wiki/Metadata

Upvotes: 1

Wouter van Nifterick
Wouter van Nifterick

Reputation: 24116

HeidiSQL can search an entire mysql host via a slick GUI.

Just press control+shift+f

It'll show a search window where you can select which databases, tables, views and field-types to search. Results are presented in a neat list.

You can get the results as SQL that selects the rows where your text was found.

...

Of course you can also do it the old-fashioned way:

Use mysqldump.exe to export to a file, and then use grep to find your searchtext.

Upvotes: 4

Related Questions