Link to home
Start Free TrialLog in
Avatar of gmanpert
gmanpert

asked on

How to get list of Innodb tables in a MySQL database

Anyone know a quick way to generate a list of Innodb tables in a database?
I hosed my ibdata files and need to figure out which tables are Innodb so I can restore them from a backup file.

-G
Avatar of racek
racek
Flag of Sweden image

SELECT * FROM information_schema.`TABLES` where enging = 'InnoDB'
ASKER CERTIFIED SOLUTION
Avatar of racek
racek
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I would use something like the attached code. Assumes you are already connected to the DB
<?php  
  
  $query = 'SHOW TABLES';
  if ($results = mysql_query($query)) {
    $success = true;
    $tables = array();
    if (mysql_num_rows($results) > 0) {
      while ($row = mysql_fetch_row($results)) {
        $tables[] = $row[0];
      }
    }
  }
  
  // the array $tables now holds a list of tables in the database
    
  
?>

Open in new window

Sorry, missed the InnoDB protion of the question. Better to go with racek.