Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get list of Innodb tables in a MySQL database

Posted on 2009-05-05
4
Medium Priority
?
862 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:gmanpert
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:racek
ID: 24307202
SELECT * FROM information_schema.`TABLES` where enging = 'InnoDB'
0
 
LVL 14

Accepted Solution

by:
racek earned 2000 total points
ID: 24307210
:-)
SELECT * FROM information_schema.`TABLES` where ENGINE = 'InnoDB'
0
 
LVL 18

Expert Comment

by:Hube02
ID: 24307218
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

0
 
LVL 18

Expert Comment

by:Hube02
ID: 24307232
Sorry, missed the InnoDB protion of the question. Better to go with racek.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question