Searching PHPmyadmin

Discussion in 'Databases' started by Matthew Sayle, Sep 12, 2015.

  1. #1
    I have about 200 databases in phpmyadmin.

    I accidentally deleted all of the files in one of the directories, but I still need the .sql database.

    Now I have no idea which one it is, because the wp-config file is gone.

    Is there a way to search for the URL inside of wp-options without checking every single one?

    Thanks!
     
    Matthew Sayle, Sep 12, 2015 IP
  2. imgtrex

    imgtrex Peon Affiliate Manager

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    3
    #2
    Hi,

    You have 200 databases or tables?
     
    imgtrex, Sep 12, 2015 IP
  3. Matthew Sayle

    Matthew Sayle Illustrious Member

    Messages:
    3,325
    Likes Received:
    464
    Best Answers:
    1
    Trophy Points:
    435
    #3
    200 separate databases.
     
    Matthew Sayle, Sep 12, 2015 IP
  4. senecacollege

    senecacollege Well-Known Member

    Messages:
    457
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #4
    I think there is not direct way in phpmyadmin, you need to write a small php script and run it
    You may try this

    
    $con = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    $res = mysql_query("SHOW DATABASES");
    
    while ($row = mysql_fetch_assoc($res)) {
        mysql_select_db($row['Database'], $con);
        $result2 = mysql_query("SELECT option_id FROM `wp_options` WHERE option_value like '%your_search_url%' and option_name ='siteurl'");
        $row2 = mysql_fetch_row($result2);
        if($row2[0]!=''){
            echo $row['Database'];
            exit;
        }
    }
    
    mysql_close($con);
    
    Code (markup):
     
    senecacollege, Sep 21, 2015 IP