How to get a list of MySQL views ?

Posted by Annan on Stack Overflow See other posts from Stack Overflow or by Annan
Published on 2010-05-14T12:21:32Z Indexed on 2010/05/14 12:24 UTC
Read the original article Hit count: 257

Filed under:

I'm looking for a way to list all views in a database.

Initially I found and tried an answer on the MySQL forums:

SELECT table_name
FROM information_schema.views
WHERE information_schema.views.table_schema LIKE 'view%';

How ever this doesn't work, returning an empty set. (I know they're in there!)

These also fail:

mysql> use information_schema;
Database changed
mysql> select * from views;
ERROR 1102 (42000): Incorrect database name 'mysql.bak'
mysql> select * from tables;
ERROR 1102 (42000): Incorrect database name 'mysql.bak'

Why isn't this working?

© Stack Overflow or respective owner

Related posts about mysql