Results 1 to 9 of 9
  1. #1
    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

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

  3. #3
    Join Date
    Jun 2004
    Location
    Oregon
    Posts
    1,315
    no, all the databases structures are different.

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

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

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

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

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

  9. #9
    Join Date
    Aug 2002
    Posts
    484
    I think Webmin may do this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •