Results 1 to 9 of 9
-
08-31-2007, 10:02 PM #1Web Hosting Master
- Join Date
- Jun 2004
- Location
- Oregon
- Posts
- 1,315
is there any program or script that can search mysql databases?
Looking for a program or script able to search certain text in all mysql databases under a user. phpmyadmin is able to do that for one database, but I need to be able to search all the databases.
Thanks
-
08-31-2007, 10:53 PM #2Web Hosting Master
- Join Date
- Oct 2004
- Location
- Kerala, India
- Posts
- 4,771
Is the word found in a table that is having same name in all databases?
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android
-
08-31-2007, 11:09 PM #3Web Hosting Master
- Join Date
- Jun 2004
- Location
- Oregon
- Posts
- 1,315
no, all the databases structures are different.
-
08-31-2007, 11:25 PM #4Disabled
- Join Date
- May 2006
- Posts
- 1,426
you can just go to the sql directory and do find and grep
for example
find /var/lib/mysql/usersdir -name *.* | exec grep searchstring
Im sure there is probably other ways and better ways but if I had to find something in someones db Id use that.
-
08-31-2007, 11:40 PM #5Web Hosting Master
- Join Date
- Jun 2004
- Location
- Oregon
- Posts
- 1,315
no, what I want to do is search text from all the records inside the databases, not the database name.
-
09-01-2007, 01:04 AM #6Disabled
- Join Date
- May 2006
- Posts
- 1,426
yeah that's what it does it finds all files in the directory, since there are different extensions you can put *.* then when it finds them which it will find them all it will grep each file for whatever string you are looking for
or you could just grep the entire directory
-
09-01-2007, 01:07 AM #7Retired Moderator
- Join Date
- Sep 2004
- Location
- Flint, Michigan
- Posts
- 5,766
He doesn't want to search for the actual database names or table names, he wants to search for data within each of those MySQL databases.
As far as I know nothing exists that will handle this out of the box. You could either spend the time doing it by hand, or you could automate it. It really depends on how many databases you have to go through as to if you want to automate it or not.
If you have a list of the databases you can just create a SQL file with your queries and a shell script to run it on all existing databases (from your text list or however you want to list the names).
How many databases are we talking about here?█ Mike from Zoodia.com
█ Professional web design and development services.
█ In need of a fresh hosting design? See what premade designs we have in stock!
█ Web design tips, tricks, and more at MichaelPruitt.com
-
09-01-2007, 01:50 AM #8Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
Well, mysql does store its data as files and although they're binary format they're not encrypted - you would expect simple text strings to be searchable by grep, giving you a list of tables containing the search text. It might not be 100% reliable but SecureServerTech's suggestion should work.
Normally though there's no separation of database files into user directories, so you might end up searching all databases belonging to all users unless you're on a control panel using the username_dbname name convention:
grep -lr "text" /var/lib/mysql/username_*Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
09-02-2007, 01:36 PM #9Web Hosting Evangelist
- Join Date
- Aug 2002
- Posts
- 484
I think Webmin may do this?